Is SwiftUI backwards-compatible with iOS 12.x and older?

前端 未结 11 1741
温柔的废话
温柔的废话 2020-12-01 08:36

If I have an app made with SwiftUI, will it work for iOS below iOS 13?

11条回答
  •  爱一瞬间的悲伤
    2020-12-01 09:33

    only works for ios 13 or later

    you can still attach your SwiftUI code by using

    @available(iOS 13.0, *)
    

    if you still using Xcode below Xcode 11 and have SwiftUI code, you can wrap it with

    #if canImport(SwiftUI)
    ...
    #endif
    

    This can fix the issue when compiling with Xcode below Xcode 11

提交回复
热议问题