Swift 2.0 / iOS 9 Compatibilities - ios

I have a few issues concerning the recent addition of Swift 2.0 and upcoming iOS9.
Currently I have been working on an app that works with iOS7 or above, and using Swift 1.2 things...nothing that Swift 2 has. I was told that I should start updating everything to include Swift 2 rather than the older ways of using Swift. So my questions are...
1) If I do begin to work with Swift 2 code, will iOS 7 and iOS 8 be able to recognize that code, or does Swift 2 only work with certain versions of iOS?
2) If I choose NOT to work with the Swift 2 code and stick with what I have that works already for iOS 7 and 8, is it possible that in iOS9 or later, it won't work because it expects Swift 2 and it's not getting it?
I have looked for compatibility articles and answers online and found nothing. The only thing I've learned is that Swift 2 just adds code, and doesn't necessarily change anything...so maybe just keeping my old code would be okay. But again I'm not exactly sure. Thanks.

The code will work as far back as iOS 7 for right now, regardless of what version of Swift you are using. As far as whether you should update your code, that's up to you, but of course Swift 2.0 does offer a lot more in terms of safety and error checking so if you find situations where it would be pertinent to implement such new features, then you probably should. Also some syntax is different, but if you update now you'll just be future-proofing yourself.

Related

What is min supported iOS for Swift 5.1?

What is the min iOS which works well with Swift 5.1 or incoming Swift 5.2?
Are there any references to check this?
A similar question has been asked before, when Swift 4 came out. You can find the question and answer here.
Having that said, the swift.org site and the release notes only specify the compatibility with previous Swift versions, the operating systems and the toolchain (Xcode). So, a straight forward answer can't be given to this question.
Since Swift 5.1 is compatible with Swift 4, you can safely assume the code will run iOS 11 and probably iOS 10 as well. There are, however, some incompatibilities between Swift 5.1 and Swift 4, see for the details this link. I think you should also be aware of the fact that as of iOS 11 32 bit is not being supported anymore.
The next issue you will definitely run into are the deprecated functions in iOS. You have to build your code in the productive version of Xcode and that tool will throw errors and warnings for deprecated functions or variables being changed. For instance, the key "[UIImagePickerControllerOriginalImage" has been changed to "UIImagePickerController.InfoKey.originalImage". at the moment Xcode 11.3 doesn't let you specify below 12.1, so you will run into these problems when updating source code written in an older version.

How can I put in charts with swift 3 Xcode 8?

I'm beginner swift developer. Just for a week now I've been trying to implement some kind of chart into my app. I know Swift 4 and Xcode 9 are already out but I'm still using Swift 3 and Xcode 8. I've read a lot of tutorials and different pages but still I'm not able to find any working ones. All examples are either too old or for swift 4. I've learned about using Cocoapods and other frameworks such as Firebase or Alamofire work just fine.
Please let me know if you can help me with finding some chart library that actually works as it is supposed to.
To get things materialistic and kick off, for building charts in iOS try Charts library. One of the best third-party libs out there.
Or check this list for even more awesome iOS charts libraries.

Many errors after update to swift 3

Hello i'm working on swift 2 with parse then i just updated to swift 3
and i got many errors the app was working perfect. Here is some errors i would get help with:
Another swift file
other errors:
How cannot assign that object into nsarray and it was working good.
so how could i fix them, any help will be appreciate.
You should read Swift 3.0 Migration Guide. It covers everything you need to know about new Swift 3 API changes. Since standard library changed a lot, it is common for third party frameworks to not work fully since they all use standard library as an underlying framework.

Swift 3.0 will not be 2.2 source compatible... will I have to rebuild my apps?

http://thenextweb.com/apple/2016/05/09/swift-3-0-developer-previews-wwdc/#gref
Does this mean anything? Will I have to completely rebuild my apps or merely convert 2.2 syntax to 3.0?
Swift 3.0 will not be compatible with 2.2. Here is the list of the current proposals, it also details what has been implemented already, and what will be :
https://github.com/apple/swift-evolution
You will not have to entirely rebuild your App, but you will have to adapt your code.
I'd say no. Every Swift app comes with its own runtime and standard libraries of whatever Xcode version you used to build it. Some of my Swift 1.0 app still runs on the latest version of El Capitan.
Source incompatibility means you can't take valid code written in Swift 2, feed it to the Swift 3 compiler and expect everything to go smoothly. There will be errors and deprecation warnings, much of which you already see today with Swift 2.3.
You also can't take a compiled application written in Swift 2 and make it run without modification on a Swift 3 runtime either. Swift is lacking a stable Application Binary Interface (ABI) at the moment. That's why every Swift app must carry its own runtime. OS X and iOS don't provide those at the system level. Hence Swift app tends be larger in size, more of a problem on iOS than OS X.
With Swift 3, Apple is trying to establish a stable ABI so your compiled Swift 3 can run without modification on the Swift 4 runtime, whenever that comes.
What about source code compatibility? No one knows what Chris Lattner has in mind or what he considers archaic. Removing the ++ and -- operator in Swift 3 seem superfluous to me. And why kill C-style for loop too?
I'm currently adapting all my code to the present state of Swift 3. The existing code is certainly not compatible; most methods have been renamed, case names have been lowercased, and so on. To what extent Apple will assist by providing a migration tool is unknown, as that's in the future.
#CodeDifferent provided a great answer, but I'd like to extend on it.
AFAIK, if your Swift 2 app is compiled with its own runtime linked in (i.e., not relying on the system runtime), then your app will run fine & there's no need to rebuild on a Swift 3 machine to run on a Swift 3 machine. But if there's no runtime compiled into the app, then your app won't run on a machine with a Swift 3 ABI.
Of course, if you are going to compile with application with Swift 3, then you will have to re-build.

using panoramaGL library in ios5 and running HelloPanorama

I've been search around how to setup panoramaGL for a whole day and none of these answers my questions. emm, maybe that's because I am new to ios developing and I start with ios5 with all ARC cool features. I did find a pretty comprehensive guide at http://www.codeproject.com/Articles/60635/Panorama-360-iPod-Touch-iPhone but it's a little bit out of date to me. I cannot follow this guide in xcode 4.3 with ios 5.0 sdk.
Emm, so here is the question, assuming panoramaGL and helloPanorama works perfectly fine in whatever xcode version and sdk version it is created in. Is there a way , without any code modification, I can import the library and using the api along with my app developed in ios5? Of course I don't mind some minor modification and I did dive into those code and comment all the retain or release stuff. but wired errors keep popping up. I really need help here.
If it finally turns out to be impossible to reuse it in ios5.0, I will probably need to write the whole thing line by line with my understand of the complicated panorama algorithm...
Thanks so much for the help!
It seems someone is working on another library based on panoramaGL. Works on IOS 5.
See http://code.google.com/p/tk-panorama/
The new version of PanoramaGL 0.1 r2 was released, please check http://code.google.com/p/panoramagl/. This version runs on iOS >= 4.x and supports Hotspots.
Please check HelloPanoramaGL example

Resources