Search code examples
swiftios12swiftui

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


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


Solution

  • I just checked it out in Xcode 11 and can confirm it won't be backwards-compatible, as can be seen in SwiftUI's View implementation:

    /// A piece of user interface.
    ///
    /// You create custom views by declaring types that conform to the `View`
    /// protocol. Implement the required `body` property to provide the content
    /// and behavior for your custom view.
    @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
    public protocol View : _View {
    
        /// The type of view representing the body of this view.
        ///
        /// When you create a custom view, Swift infers this type from your
        /// implementation of the required `body` property.
        associatedtype Body : View
    
        /// Declares the content and behavior of this view.
        var body: Self.Body { get }
    }