Created
March 12, 2025 03:28
-
-
Save Kyle-Ye/2749b2283bd31b75c5363799861ec5f8 to your computer and use it in GitHub Desktop.
_TestApp.setSemantics
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
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) | |
@_originallyDefinedIn(module: "SwiftUI", iOS 18.0) | |
@_originallyDefinedIn(module: "SwiftUI", macOS 15.0) | |
@_originallyDefinedIn(module: "SwiftUI", tvOS 18.0) | |
@_originallyDefinedIn(module: "SwiftUI", watchOS 11.0) | |
public struct _TestApp { | |
public init() | |
public func setSemantics(_ version: Swift.String) // Add this line in your SDK - iPhoneSimulator.sdk/System/Library/Frameworks/SwiftUICore.framework/Modules/SwiftUICore.swiftmodule/arm64-apple-ios-simulator.swiftinterface | |
} |
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
// Ref: https://x.com/KyleSwifter/status/1899663558914572653 | |
// The iOS 18 SwiftUI SDK has an API to change the semantic - _TestApp().setSemantics(xx). | |
// Remember to make it public in your SDK. | |
// For lower OS version, the API does not exist. | |
// But `_TestApp.run()` will read and set it from the `CommandLine.arguments` after `--semantics`. | |
@main | |
struct SemanticsTestsApp: App { | |
init() { | |
let app = _TestApp() | |
app.setSemantics("latest") | |
// app.run() | |
} | |
var body: some Scene { | |
WindowGroup { | |
ContentView() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment