26

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?

TheEye
  • 9,280
  • 2
  • 42
  • 58
Tom Kraina
  • 3,569
  • 1
  • 38
  • 58

1 Answers1

50

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)

Cœur
  • 37,241
  • 25
  • 195
  • 267
  • Do you have a link some Apple doc showing that Xcode 9 will not be able to target arm7? I've heard this, but have not seen it documented. – Stephen Jun 09 '17 at 15:19
  • 2
    According to the Xcode 9 release notes, it's actually iOS 11 that's dropping support for 32 bit apps, not the Xcode. Therefore, you should be able to target pre-iPhone 5S devices when building in Xcode 9: "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)" – Tom Kraina Jun 10 '17 at 08:52
  • 1
    Xcode Release Notes: https://developer.apple.com/go/?id=xcode-9-beta-rn Note that you need to sign in with your dev id in order to see that page. – Tom Kraina Jun 10 '17 at 08:57