I have Xcode 7.3 installed, and the swiftc command line compiler declares that is is version 2.2, yet it is configured to target the macos10.9 sdk:
🍺> swiftc -v
Apple Swift version 2.2 (swiftlang-703.0.18.8 clang-703.0.31)
Target: x86_64-apple-macosx10.9
FWIW I am running OS X 10.11.6. Compiling Metal API code using this swiftc in this configuration results in errors such as:
src/Application.swift:76:29: error: 'MTLBuffer' is only available on OS X 10.11 or newer
var _mtlPositionBuffer : MTLBuffer?
And finally, to address this, I've compiled with the flag:
-sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
to no avail. How do you change the sdk/platform target for the swiftc command line compiler?
A software development kit (SDK) provides a set of files to build applications for a target platform, and defines the actual location of those files on the target platform or an intermediate platform that supports the target platform.
You can simply open the applications folder and move Android Studio to the trash. The same thing goes for the SDK.
The SDK is located at /Applications/Xcode. app/Contents/Developer/Platforms/MacOSX. platform/Developer/SDKs/MacOSX.
SWIFT Software Development Kit (SDK) provides a simplified way for developers to consume the growing number of API-based services available on the SWIFT platform. The SDK delivers APIs that hide much of lower-level application plumbing, including authentication, authorization, signing and error handling.
SDKs (Software Development Kits) are bundles that contain headers, binaries, and other tools needed to build for a specific version of iOS. These can be found within Xcode at Xcode. app/Contents/Developer/Platforms/iPhoneOS. platform/Developer/SDKs .
Looking at what Xcode does when compiling swift code, it uses the following CLI flag, which seems to address the problem here nicely:
-target x86_64-apple-macosx10.11
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With