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 String { | |
| subscript(_ i: Int) -> Character { | |
| self[index(startIndex, offsetBy: i)] | |
| } | |
| } |
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 View { | |
| @ViewBuilder | |
| func numericTransition(_ value: Double) -> some View { | |
| if #available(iOS 17.0, *) { | |
| contentTransition(.numericText(value: value)) | |
| .animation(.easeInOut(duration: 0.3), value: value) | |
| } else { | |
| transition(.opacity) | |
| .animation(.easeInOut(duration: 0.2), value: value) | |
| } |
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 AppConfig { | |
| static var isCompilerAtLeast62: Bool { | |
| #if compiler(>=6.2) | |
| return true | |
| #else | |
| return false | |
| #endif | |
| } | |
| // This will only return true when built from Xcode 26 and for iOS 26 on other version it will return false. |
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 View { | |
| @ViewBuilder | |
| func `if`<TrueContent: View, FalseContent: View>( | |
| _ condition: Bool, | |
| @ViewBuilder _ trueTransform: (Self) -> TrueContent, | |
| @ViewBuilder else falseTransform: (Self) -> FalseContent | |
| ) -> some View { | |
| if condition { | |
| trueTransform(self) | |
| } else { |
OlderNewer