tuist: Generated assets @available markers break compilation on Xcode 14
What happened?
We introduced a .colorset into our xcassets. When generating the project using Tuist, the generated assets swift file contains code that doesn’t compile under Xcode 14.
How do we reproduce it?
- Use this project
- Run
tuist generate -n - The TuistAssets+DemoApp.swift file will contain the following sections of code which will produce Xcode errors:
#if canImport(SwiftUI)
@available(iOS 13.0, tvOS 13.0, watchOS 6.0, macOS 10.15, *)
public private(set) lazy var swiftUIColor: SwiftUI.Color = {
SwiftUI.Color(asset: self)
}()
#endif
Error: Stored properties cannot be marked potentially unavailable with ‘@available’
#if canImport(SwiftUI)
public extension SwiftUI.Color {
@available(iOS 13.0, tvOS 13.0, watchOS 6.0, macOS 10.15, *)
init(asset: DemoAppColors) {
let bundle = DemoAppResources.bundle
self.init(asset.name, bundle: bundle)
}
}
#endif
Error: ‘Color’ is only available in iOS 13.0 or newer
Error log
Written above.
macOS version
13.0.1
Tuist version
3.15.0
Xcode version
14.2.0
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 1
- Comments: 20
How about using my demo project? When using tuist 3.12.1, it compiles successfully, and fails to compile on 3.15.0.
Thanks! That’s why it’s better to use a sample project 😜