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 private var start = Date.now | |
| var body: some View { | |
| VStack { | |
| TimelineView(.animation) { timeline in | |
| let time = start.distance(to: timeline.date) | |
| Rectangle() |
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 CustomGlyphPicker: View { | |
| @State private var name: String = "Default Name" | |
| @State private var selectedImage: String = "defaultImage" | |
| @State private var images: [String] = [ | |
| "face.smiling.inverse", | |
| "list.bullet", | |
| "house.fill", | |
| "star.fill", |
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 | |
| import AuthenticationServices | |
| class AppleAuthViewModel: ObservableObject { | |
| @Published var shouldShowAlert: Bool = false | |
| @Published var alertTitle: String = "" | |
| @Published var alertMessage: String = "" | |
| //get notified when autherization state gets change | |
| init() { |
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 | |
| fileprivate extension String { | |
| func containsConsecutiveCharacters(length: Int) -> Bool { | |
| let characters = Array(self) | |
| for i in 0..<(characters.count - length + 1) { | |
| let substring = String(characters[i..<(i + length)]) | |
| if substring.allSatisfy({ $0 == substring.first }) { | |
| return true | |
| } |
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
| struct MixedToggleStyle: ToggleStyle { | |
| func makeBody(configuration: Configuration) -> some View { | |
| HStack { | |
| configuration.label | |
| Spacer() | |
| Button { | |
| configuration.isOn.toggle() | |
| } label: { |
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
| struct DebouncingTaskViewModifier<ID: Equatable>: ViewModifier { | |
| let id: ID | |
| let priority: TaskPriority | |
| let duration: Duration | |
| let task: @Sendable () async -> Void | |
| init( | |
| id: ID, | |
| priority: TaskPriority = .userInitiated, | |
| duration: Duration = .nanoseconds(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
| struct TwoListPlayground: View { | |
| @State private var users1 = ["Paul", "Taylor", "Adele"] | |
| @State private var users2 = ["Pauline", "Tom", "Adam"] | |
| var body: some View { | |
| VStack { | |
| HStack { | |
| Spacer() |
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
| /* | |
| Third Library based -> https://github.com/lukerobertsapps/LRStreakKit | |
| */ | |
| import Foundation | |
| /// Data for a streak, codable so it can be persisted | |
| struct Streak: Codable { | |
| /// The length of the streak in days | |
| var length: Int = 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 SwiftUI | |
| fileprivate extension View { | |
| @ViewBuilder func reverseMask<Mask: View>( | |
| alignment: Alignment = .center, | |
| @ViewBuilder _ mask: () -> Mask | |
| ) -> some View { | |
| self.mask { | |
| Rectangle() |
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 BezierGridView: View { | |
| @State private var vertices: [[BezierVertex]] | |
| let rows: Int | |
| let cols: Int | |
| init(rows: Int, cols: Int) { | |
| self.rows = rows |