Swift 3 iOS compatibility

前端 未结 2 1051
借酒劲吻你
借酒劲吻你 2020-11-29 08:57

I\'m new to Apple developing and soon I will distribute my app via AppStore. So now I\'m using Swift 3 and by default the deployment target is set to iOS 10.0 It means that

2条回答
  •  盖世英雄少女心
    2020-11-29 09:53

    You should use Swift 3.x (it's the latest version of Swift since this answer has been posted).

    iOS version is NOT related to the Swift version you should use, instead, some of the new provided apis do support a minimum version of the OS. But -again- it's not related to the programming language it self. For example: an application has been built via Swift 2.x (Deployment Target 9.x) should work on iOS 10; When updating the IDE (xcode), it will support -by default- the latest version of the programming language -Swift-.

    Also, You could do:

    if #available(iOS 10, *) {
        // use an api that requires the minimum version to be 10
    } else {
        // use another api
    }
    

提交回复
热议问题