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 Optional where Wrapped: Hashable { | |
| var hashValue: Int { | |
| switch self { | |
| case .some(let hashable): | |
| return hashable.hashValue | |
| default: | |
| 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
| { | |
| "alfredtheme" : { | |
| "result" : { | |
| "textSpacing" : 4, | |
| "subtext" : { | |
| "size" : 12, | |
| "colorSelected" : "#FFFFFFFF", | |
| "font" : "CamingoCode", | |
| "color" : "#7F7F7FFF" | |
| }, |
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 ContentView: View { | |
| @State var flag = false | |
| var body: some View { | |
| VStack(spacing: 0) { | |
| Circle().fill(Color.orange) | |
| if flag { | |
| Circle() | |
| .fill(Color.red) | |
| .transition(.opacity) |
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 ContentView: View { | |
| @State var flag = false | |
| var body: some View { | |
| VStack(spacing: 0) { | |
| Circle().fill(Color.orange) | |
| if flag { | |
| Circle() | |
| .fill(Color.red) | |
| .transition(.opacity) |
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 ToggleWidthPreferenceKey: PreferenceKey { | |
| static let defaultValue: CGFloat = 0 | |
| static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) { | |
| value = max(value, nextValue()) | |
| } | |
| } | |
| extension View { | |
| func measureToggle() -> some View { | |
| self.background(GeometryReader { geometry in |
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 NSDecimalNumber { | |
| func round(decimalPlaces: Int, roundingMode: RoundingMode) -> NSDecimalNumber { | |
| let handler = NSDecimalNumberHandler( | |
| roundingMode: roundingMode, | |
| scale: Int16(decimalPlaces), | |
| raiseOnExactness: false, | |
| raiseOnOverflow: false, | |
| raiseOnUnderflow: false, | |
| raiseOnDivideByZero: false) | |
| return rounding(accordingToBehavior: handler) |
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 CustomLabelStyle: LabelStyle { | |
| @Environment(\.dynamicTypeSize) private var dynamicTypeSize | |
| private var leadingPadding: CGFloat { | |
| switch dynamicTypeSize { | |
| case .xSmall: -8 | |
| case .small: -9 | |
| case .medium: -9 | |
| case .large: -10 | |
| case .xLarge: -11 |
OlderNewer