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 | |
| /// Static properties for all preview devices. | |
| /// | |
| /// Usage: | |
| /// | |
| /// ```swift | |
| /// struct TestView_Previews: PreviewProvider { | |
| /// static var previews: some View { | |
| /// Group { |
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 { | |
| @State var horizontal: Bool = true | |
| @Namespace var namespace | |
| var body: some View { | |
| VStack(spacing: 40) { | |
| if horizontal { | |
| HStack { items } |
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 Combine | |
| import SwiftUI | |
| import CoreData | |
| class CoreDataViewModel: NSObject, ObservableObject, NSFetchedResultsControllerDelegate { | |
| let context: NSManagedObjectContext | |
| private var controllerUpdates = [NSObject: CurrentValueSubject<[NSFetchRequestResult], Never>]() | |
| init(context: NSManagedObjectContext) { | |
| self.context = context |
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
| // Usage: | |
| /* | |
| if let aStreamReader = StreamReader(path: "/path/to/file") { | |
| defer { | |
| aStreamReader.close() | |
| } | |
| while let line = aStreamReader.nextLine() { | |
| print(line) | |
| } | |
| } |
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
| // | |
| // PomodoroPicker.swift | |
| // pomodoro | |
| // | |
| // Created by David Rozmajzl on 1/1/22. | |
| // | |
| import SwiftUI | |
| struct PomodoroPicker<Content, Item: Hashable>: View where Content: View { |
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
| // | |
| // RemindersAppIcon.swift | |
| // RemindersAppIcon | |
| // | |
| // Created by David on 1/5/22. | |
| // | |
| import SwiftUI | |
| struct RemindersAppIcon: View { |
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 testColorSchemeApp: App { | |
| @StateObject private var appearanceManager = AppearanceManager() | |
| var body: some Scene { | |
| WindowGroup { | |
| ContentView() | |
| .environmentObject(appearanceManager) |
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
| extension Error { | |
| var code: Int { return (self as NSError).code } | |
| var domain: String { return (self as NSError).domain } | |
| var userInfo: [String:Any] { return (self as NSError).userInfo } | |
| func timeAfterWhichToRetry(retryCount: Int) -> TimeInterval? { | |
| // CloudKit suggests us retry too often, so slow us down as we retry a lot, up to 5 minutes | |
| if let suggestedTimeout = suggestedTimeAfterWhichToRetry { | |
| if suggestedTimeAfterWhichToRetry == 0 { | |
| return 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
| import UIKit | |
| struct IceCream { | |
| let title: String | |
| let icon: UIImage | |
| } | |
| struct AppSettings { | |
| static var fontSize = 17.0 | |
| } |