This file contains 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
// Taken from Apple's App Dev Training: https://developer.apple.com/tutorials/app-dev-training/ | |
/// This color is either black or white, whichever is more accessible when viewed against the scrum color. | |
var accessibleFontColor: Color { | |
var red: CGFloat = 0 | |
var green: CGFloat = 0 | |
var blue: CGFloat = 0 | |
UIColor(self).getRed(&red, green: &green, blue: &blue, alpha: nil) | |
return isLightColor(red: red, green: green, blue: blue) ? .black : .white | |
} |
This file contains 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 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 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; | |
extension NSApplication { | |
OlderNewer