iOS: Using Swift 4 when targeting iOS 9

Tom Kraina picture Tom Kraina · Jun 8, 2017 · Viewed 9.8k times · Source

Swift 4 is adding some really cool features, like strongly typed keypaths and JSON encoding/decoding using Codable.

I would like to use these new features while still targeting iOS 9 and above.

As far as I understand, Swift language version is not bound to a version of iOS, as opposite to Foundation framework, for example. However, I can't find any info if that's correct.

Can I use Swift 4 when targeting iOS older than 11?

Answer

Cœur picture Cœur · Jun 9, 2017

Yes, just like with Swift 1, Swift 2 and Swift 3, you can use Swift 4 with any version of iOS 7 and above.

See this similar question for Swift 3: Xcode 8 / Swift 3 and installing apps on iPhone 4 running iOS 7
See this similar question for Swift 2: Swift 2.0 minimum system version requirement (deployment target)


Note: as iOS 11 is dropping support for 32-bit, you will only be able to use iOS 11 from an arm64 slice (that is, from iPhone 5S and up). Source:

iOS 11 no longer supports armv7 or armv7s (32-bit). If an iOS target has an iOS Deployment Target of 11, then it will not build for 32-bit. iOS targets with an iOS Deployment Target earlier than 11 will still build for 32-bit by default. (32163517)