Which swift version for iOS 7+ - ios

I'm new to iOS development, trying to develop an application.
Once I've seen in these statistics that iOS 7 has a really small market share I decided to support iOS 7 or higher in a way to make an app to all iphone OS available in the market. I also decided to use swift as code language but not sure which swift version should I choose.
Which swift version should I choose for iOS 7 or higher development?

Apple states that
Starting July 2018, all iOS app updates submitted to the App Store must be built with the iOS 11 SDK and must support the Super Retina
display of iPhone X.
(The same requirement for new apps started on April 2018.)
So, your choice are very few, Xcode 9 (with iOS 11 SDK) or Xcode 10 (with iOS 12 SDK).
(I believe we should read the requirement as iOS11 SDK or later.)
And supporting iOS 7 with Xcode 9/10 is very difficult. (I do not know if it is possible or not.) Deployment Target does not accept versions less than 8.0 (*), and iOS 7 Simulators are not provided.
(*) Some versions of Xcode replaces versions less than 7.0 to 8.0, even if I entered the version number manually. And at least, both Xcode versions does not show 7.x in the popup menu of the Deployment Target.
I recommend you to use the latest released version of Xcode (10, which comes with Swift 4.2), and make your minimum supported version to iOS 8.0 or later.

The Swift application will work only on iOS 7+. The Xcode will add the Swift library to every build so, you can use any version of Swift language and all of them will work on all iOS starting from 7th. Apps created with Swift will run on iOS 7+ and Mac OS 10.9 +
so use the latest version always.

You have to use the latest swift version Swift 4.2
As iOS 12 is out now so you have to use iOS 10 and above because we should support recent 3 versions.
Images source
If you target iOS 10 and above then you hit the 95% users

Related

Apple requiring all app updates to built with iOS 12 SDK by March 2019 Question

I'm currently using Xcode 9 but I have downloaded and "installed" the iOS device support files for 12.
Am I good to go for the March iOS 12 deadline?
Is satisfying the requirement as simple as submitting a new build when needed with my current setup or is more work required?
You need to migrate to Xcode 10 to get the iOS 12 SDK support files. Your app must be build with this iOS 12 sdk support. This is not the same as pulling iOS 12 device support into Xcode 9 from Xcode 10.x versions. Currently, going directly to 10.1 is the best move. Fortunately, Swift 3 and 4 are currently supported in Xcode 10.1. So if you are still on Swift 3 you will not have to also migrate your swift version.
Xcode 10.2 (currently in beta) will add support for swift 5. Migrating from Xcode 10.1 to 10.2 will require you to be on Swift 4.2 as a minimum version, with Swift 5 being recommended.
After the deadline, any app submissions will need to be built with Xcode 10 or better, or else they will be rejected.

How can I tell which iOS versions my XCode will deploy to?

I currently have XCode version 8.2.1.
On my iPhone, I currently have iOS 10.3.2.
My version of XCode will not deploy to anything over iOS 10.2.
On my iPhone, I am being offered an upgrade to iOS 11.0.3.
According to this wiki here, XCode version 9 will deploy to iOS 11.0: https://en.wikipedia.org/wiki/Xcode#9.x_series. But I can't tell whether this includes all the sub-versions, eg 11.0.3.
So my question is, if I get XCode version 9 and upgrade my phone to iOS 11.0.3, will I be able to deploy to my phone from XCode? How do I tell exactly which versions of iOS are supported by each version of XCode? And going forward, how can I ensure that my iPhone and iPad always have versions of iOS which I am able to deploy to from XCode?
Yes, you will be able to deploy to your phone.
While you need Xcode 9 and not 8 to program against iOS11, this question has more to do with the Base SDK and Deployment Target settings in your project.
The Base SDK is the SDK version you are compiling against. In Xcode 9, this could be iOS11, for example. The Deployment Target setting represents the lowest supported iOS version the app will run on. This might be iOS10, per your example, but it could be anything else.
To use the newest iOS11 features, you'd have to have a minimum Base SDK of iOS11. To support older platforms, you must make sure the Deployment Target is set to the oldest version you'd support. In code, you need to check the version of the platform when deciding to use a newer-than-Deployment-Target feature.
if I get XCode version 9 and upgrade my phone to iOS 11.0.3, will I be able to deploy to my phone from XCode?
Yes. Xcode 9 and iOS 11 are both the latest (as of Oct. 2017) versions available. If you want to support iOS 11, you need Xcode 9.
How do I tell exactly which versions of iOS are supported by each version of XCode?
Check the release notes. For example, the Xcode 9 Compatibility section says:
Xcode 9 includes SDKs for iOS 11, watchOS 4, macOS 10.13, and tvOS 11
And going forward, how can I ensure that my iPhone and iPad always have versions of iOS which I am able to deploy to from XCode?
Staying current with the latest iOS and Xcode versions is one way to do that. You don't even need the latest iOS version on your phone -- just any version that's later than the minimum version supported by whatever Xcode you're using. Looking at the list of available deployment targets, I can see that Xcode 9 deploys to iOS versions back to iOS 9.1.
Mostly, just be aware that updating iOS on your phone may require you to also update Xcode.

Xcode 8 no support iOS 7

I've upgraded my Xcode to Xcode 8. Now I notice that I cannot run/debug on an iPhone with iOS 7.n.n. I've have read that it isn't supported in Xcode 8. I do know that my app will still work on iOS 7, but if something fails I would like to hang it on Xcode to debug it. So my question is:
Do I still get the bug fixes/improvement that were introduced in iOS 10 when submitting my app with a base sdk setting of iOS 9.3?
Xcode 8 (or even Xcode 7) doesn't include support for iOS 7 simulator, which is what I think you're really asking about.
To pick up the new iOS 10 SDK changes, link against the iOS 10 SDK and then set your target's minimum deployment version to iOS 7.
If you were using analytics, chances are very high that you'll find the number of iOS 7 using customers is incredibly low.
Do I still get the bug fixes/improvement that were introduced in iOS 10 when submitting my app with a base sdk setting of iOS 9.3?
No, of course not. If you do that, you are still an iOS 9 app. You must link against iOS 10 if you want to run natively under iOS 10.
However, you can do that and still be backward compatible to iOS 7. And you can easily test on an iOS 7 device, so the change to Xcode 8 does you no harm.

Can I downgrade iOS Deployment Target when submitting a new version?

My app is available on the Appstore and is currently compatible with iOS 6 or later.
I want to release a new version only compatible with iOS 7 or later because there's a lot of crashes on iOS 6 with this new version and I have to release ASAP.
Here's my question : when the iOS 6 crashes will be fixed, would it be possible to bring back the iOS 6 compatiblity (i.e. downgrade the IPHONEOS_DEPLOYMENT_TARGET from 7.0 to 6.0) ? Does Apple allow that ?
Thanks in advance.
Your iOS Deployment Target can be whatever you wish it to be. The main requirement that Apple has is that your app submission is compiled against the latest SDK at the time (currently Apple is accepting base SDK of iOS 7, but it will change to iOS 8 in the new year).
When you downgrade the deployment target back down to 6, the only thing you have to ensure is that you're not calling any iOS 7+ APIs when running on iOS 6 devices, otherwise you'll be creating a lot of crash reports.
edited after better understanding the original question

Using ios 6.1 sdk with ios8

I have installed the ios 6.1 sdk in xcode 6 and it shows up in my base sdk drop-down.
I selected it and the app builds but when it launches on the ipad (ios 8) it seems to have a very broken apperence as if its trying to use ios 8 sdk. In ios 7 we were able to use the ios 6.1 sdk on ios 7, is this ability totally removed in ios 8?
This is an enterprise applicaiton, and the client is trying to avoid paying from a full refresh to ios 8.
Dropping an old SDK into a newer copy of Xcode is untested and unsupported by Apple, and it's no wonder you're seeing the problems you're seeing.
If you want to support an earlier version of iOS while using the latest SDK, just set the Minimum Deployment iOS version in your target's build settings (as described here in the Apple documentation I've included).
p.s. On the other hand, if you really want to keep using the iOS 6.1 SDK... use the Xcode version the SDK came with. And it should hopefully look proper under iOS 6, and it'll look like an iOS 6 app under iOS 7 & iOS 8.
p.p.s. Your client is cheap.

Resources