This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def bit_is_set(byteval,idx): | |
| return ((byteval&(1<<idx))!=0) | |
| def read_int_bbo(f, s, signed=False): | |
| return int.from_bytes(f.read(s), byteorder='big', signed=signed) | |
| def decompressECD(f, out_fname): #file handle at ECD start position, out file name | |
| magic = f.read(3) | |
| if not magic == b'ECD': | |
| return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| enum Weekday: Int { | |
| case monday = 1 | |
| case tuesday = 2 | |
| case wednesday = 3 | |
| case thursday = 4 | |
| case friday = 5 | |
| case saturday = 6 | |
| case sunday = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // reloadDataを使わないようにしましょう | |
| import UIKit | |
| import DiffableDataSources // https://github.com/ra1028/DiffableDataSources | |
| @available(iOS, introduced: 13.0) | |
| typealias TableViewDiffableDataSource = UITableViewDiffableDataSource | |
| @available(iOS, introduced: 13.0) | |
| typealias DiffableDataSourceSnapshot = NSDiffableDataSourceSnapshot | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| enum Cats { | |
| private struct CatResponse: Decodable { | |
| let url: URL | |
| } | |
| @discardableResult | |
| static func getRandomImageURL(completion: @escaping (URL?) -> Void) -> URLSessionDataTask { | |
| let request = URLRequest(url: URL(string: "https://api.thecatapi.com/v1/images/search")!) | |
| let task = URLSession.shared.dataTask(with: request) { data, _, _ in | |
| let catURL: URL? = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| @main | |
| struct ToDoApp: App { | |
| @StateObject var model: Model = .init() | |
| var body: some Scene { | |
| WindowGroup { | |
| ScrollView { | |
| VStack(alignment: .leading) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| final class BracketScanner { | |
| let text: String | |
| init(text: String) { | |
| self.text = text.trimmingCharacters(in: CharacterSet(charactersIn: "()")) | |
| } | |
| lazy var scanner: Scanner = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| @main | |
| class AppDelegate: UIResponder, UIApplicationDelegate { | |
| var window: UIWindow? | |
| func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | |
| func makeRefreshControl() -> UIRefreshControl { | |
| let refresh = UIRefreshControl() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // The main layout logic | |
| import SwiftUI | |
| final class LayoutAdaptor: UIView { | |
| var layout: (any Layout)? { | |
| didSet { setNeedsLayout() } | |
| } | |
| override func layoutSubviews() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| struct ContentView: View { | |
| var body: some View { | |
| CoreTextShape( | |
| string: "Hello YUMEMI.swift!", | |
| font: .boldSystemFont(ofSize: 42) | |
| ) | |
| .border(.purple) | |
| .padding() |
OlderNewer