Reputation: 61
I am making a macOS app with Xcode 9.0.1 and Swift 4. I want to ask if the released app (.app file) can work on macOS earlier than 10.13 (e.g., 10.9 or 10.11) or will it work only on macOS 10.13?
Upvotes: 1
Views: 149
Reputation: 437532
Set the "Deployment Target" for your "Project" settings (not your target settings) and it will build an app that supports that version and later. E.g. if you set the deployment target to 10.11, it will support 10.11 at later (e.g. 10.11, 10.12, 10.13, etc.).
Note, when you first discover this drop down box, you may be tempted to set it to the earliest possible OS version, but realize that the more versions that you want to retroactively support, the more work that entails. You'll have to write conditional code wherever you want to use newer OS features and likewise wherever older targets need to use now-deprecated APIs.
FYI, there are a few constraints introduced by various Xcode features. E.g. Swift, itself, requires macOS 10.9 or later. Storyboards require macOS 10.10 or later. Etc.
In short, set your deployment target, but do so with awareness of the cost-benefit trade-off that decision may entail.
Upvotes: 4
Reputation: 2824
The earliest version of macOS that will be able to run your application is equal to your Deployment Target setting, which can be found in Build Settings of your .xcodeproj in Xcode.
This way, application built with Deployment Target set to 10.13 will not launch on 10.12 and earlier.
Not to be confused with Target SDK.
Upvotes: 0