Development Tip

SwiftUI는 iOS 12.x 및 이전 버전과 역 호환됩니까?

yourdevel 2020. 11. 1. 18:44
반응형

SwiftUI는 iOS 12.x 및 이전 버전과 역 호환됩니까?


swiftUI로 만든 앱이있는 경우 iOS 13 이하의 iOS에서 작동합니까?


방금 Xcode 11에서 확인했고 SwiftUI의 View구현 에서 볼 수 있듯이 이전 버전과 호환되지 않을 것임을 확인할 수 있습니다 .

/// 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 }
}

모든 라이브러리가 이미 iOS 13 이상용으로 주석 처리되어 있기 때문에 그렇게 생각하지 않습니다.

또한 설명서 에서 Apple은 지원되는 버전을 명확하게 언급합니다.

  • iOS13.0 + 베타
  • macOS10.15 + 베타
  • tvOS 13.0+ 베타
  • watchOS 6.0+ 베타

여기에 이미지 설명 입력


그것은 수있는 하위 호환성

Swift 5.1 is not released yet and SwiftUI uses features such as opaque return types, DSL, propertyDelegate(introduced in WWDC as propertyWrapper) and etc, which will be available only in Swift 5.1. Since Swift 5 is binary stable, I guess it was not possible to use embedded swift-frameworks inside Xcode11, hence they’ve re-implemented these features in Cocoa’s core and marked them as iOS13+ available until Swift 5.1 gets released.

My assumptions are based on the fact that, Ordered Collection Diffing and DSL are going to be available in Swift 5.1 and have no correlations with Xcode or Apple’s eco-system, but they’re also marked as @available(iOS13,...). This means that they had to mark everything using Swift 5.1 features with the iOS availability attribute. Some of them will get removed once Swift 5.1 gets released, but we can’t be sure about SwiftUI and Combine unless Apple tells otherwise. This is also mentioned in DSL’s proposal:

Implementation: PR. Note that the implementation in the Xcode developer preview uses a somewhat simpler transformation than that described here. The linked PR reflects the implementation in the preview but is under active development to match this proposal.

So backward incompatibility limitation might be lifted when Swift 5.1 gets released, but it really needs to be clarified by Apple team.


No. SwiftUI requires a deployment target of iOS 13 or later, macOS 15 or later, tvOS 13 or later, or watchOS 6 or later. The framework contains many new types that don’t exist on older versions of the OSs.


If you are shooting to support iPhone and not iPad you could probably expect most users will upgrade to iOS 13 within 12-18 months(starting with the release date). Maybe 85-90%? (I think Apple said at this point theres still 15% of people not on iOS 12) That’s still quite a while though to where you aren’t going to be able to deploy SwiftUI apps right away or else risk alienating a lot of users.

Also depending on what the other 10-15% is, that could mean a lot of users (and $$) for you left on the table.

If you are supporting iPad as well then its more tricky because people don't upgrade their iPads as often. Theres a lot of iPad 2s along with 3rd and 4th generation iPads still out in the wild, that only have 10.3.3 and cannot upgrade anymore. People just aren't going to go get up and go pay between $400 - $1,000 for a new iPad when theirs works perfectly fine.

There’s always room and a need for updating the app, making it better, fixing bugs, that don’t necessarily have anything to do with iOS 13. i.e. finding a bug you didn’t know about before that making a lot of users unhappy.. not on the latest iOS version. and we haven't even talking about enterprise / corporate customers that a lot of dev shops support. theres a lot of more pushback on iOS updates for various reasons in that area.

So before you get all excited about iOS 13 and SwiftUI (which you absolutely should because its awesome), back in the real world, outside of Silicon Valley, that's not exactly going to align with what the average consumer expects and you will need to support older devices and need to because theres just too many people you would be alienating.


It is compatible with iOS 13+. Here is link to its documentation.

https://developer.apple.com/documentation/swiftui/


Even Xcode 10 does not support it. You need to use Xcode 11 which is in beta as of (Jun 3 2019). https://developer.apple.com/tutorials/swiftui/creating-and-combining-views


Based on Apple documentation it's available only starting with iOS 13, unfortunately.

https://developer.apple.com/documentation/swiftui/


모두가 말했듯이 이전 iOS 버전과 하위 호환되지 않습니다. 그러나 Apple은 지속적으로 최신 iOS의 높은 설치 기반을 보유하고 있으며 iOS 13에는 iPhone 6S 이상, iPad Air 2 이상, 새로운 iPad mini 4 및 iPhone SE가 필요합니다. 대다수의 사용자는 iOS 13을 설치하고 멋진 SwiftUI 앱을 즐길 수 있습니다.


iOS 13 이상에서만 작동합니다.

계속 사용하여 SwiftUI코드를 첨부 할 수 있습니다.

@available(iOS 13.0, *)

참고 URL : https://stackoverflow.com/questions/56433305/is-swiftui-backwards-compatible-with-ios-12-x-and-older

반응형