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
| /** | |
| * ContentView.swift | |
| * StickyTest | |
| * | |
| * Created by Nick Spreen (spreen.co) on 5/28/25. | |
| * | |
| */ | |
| import SwiftUI |
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
| // | |
| // NSApplication+openSettings.swift | |
| // | |
| // Created by Stephan Casas on 12/3/23. | |
| // | |
| import SwiftUI; | |
| fileprivate let kAppMenuInternalIdentifier = "app" | |
| fileprivate let kSettingsLocalizedStringKey = "Settings\\U2026"; |
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 StringProtocol { | |
| subscript(_ offset: Int) -> String.Element { | |
| if offset >= 0 { | |
| self[index(startIndex, offsetBy: offset)] | |
| } else { | |
| self[index(endIndex, offsetBy: offset)] | |
| } | |
| } | |
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 TaskTrigger<T: Equatable>: Equatable { | |
| fileprivate enum TaskState<S: Equatable>: Equatable { | |
| case inactive | |
| case active(value: S, uniqueId: UUID? = nil) | |
| } | |
| fileprivate var state: TaskState<T> = .inactive |
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
| // | |
| // TranslucentTitleBarApp.swift | |
| // TranslucentTitleBar | |
| // | |
| // Created by Alexander Sandberg on 20.10.22. | |
| // | |
| import SwiftUI | |
| @main |
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
| public extension Spacer { | |
| static func maxHeight(_ value: CGFloat) -> some View { | |
| Spacer(minLength: 0) | |
| .frame(maxHeight: value) | |
| .layoutPriority(-1) | |
| } | |
| static func maxWidth(_ value: CGFloat) -> some View { | |
| Spacer(minLength: 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
| extension Dictionary { | |
| public subscript(path string: Key, separator separator: String) -> Value? where Key == String { | |
| get { self[path: string.split(separator: separator).map(String.init)] } | |
| set { self[path: string.split(separator: separator).map(String.init)] = newValue } | |
| } | |
| public subscript(path path: Key...) -> Value? { | |
| get { self[path: path] } | |
| set { self[path: path] = newValue } |
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 PublishedObject // https://github.com/Amzd/PublishedObject | |
| import SwiftUI | |
| /// A property wrapper type that instantiates an observable object. | |
| @propertyWrapper | |
| public struct StateObject<ObjectType: ObservableObject>: DynamicProperty | |
| where ObjectType.ObjectWillChangePublisher == ObservableObjectPublisher { | |
| /// Wrapper that helps with initialising without actually having an ObservableObject yet |
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 | |
| extension Date { | |
| /// Returns date where **-component** is rounded to its closest | |
| /// multiple of **-amount**. Warning: month and day start at 1 | |
| /// so round(to: 6, .month) will either return month 1 or 7! | |
| func round(to amount: Int, _ component: Calendar.Component) -> Date { | |
| let cal = Calendar.current | |
| var value = cal.component(component, from: self) |
NewerOlder