TIP - Loading an Xcode app from Older version of Swift

Seems if you load a Swift application from the Internet and it was written in an older version of Swift (version 3 seems to be the most common)… Xcode will refuse to run it… saying you need an older version of Xcode to bring it up to date.

However I found this is not true… :slight_smile:

If you run across such a situation do this

  • Load the app into the most current version of Xcode
  • ignore the error message the comes up
  • Go to “BUILD SETTINGS” and search for “VERSION”
  • Scroll all the way to the bottom of the search results to “Swift Langauge Version”
  • simply change it to the current Swift version (which at the moment is 5)
  • Attempt to compile the app
  • Xcode will mark any lines the need to be updated, and usually will do it for you
2 Likes

Apple really needs to stabilize the language
All the shifts from version 1 to 2 to …
Its their version of API 2

Well up until about Swift 3, the changes were annoying… But Xcode has a HUGE advantange over the Xojo IDE in the fact that 95% of the changes are found by Xcode, identified to the developer, and a “fix” is suggested… just click the mouse, and Xcode rewrites the offending line of code in the updated syntax.

Now I will admit, a huge amount of the changes between 4 and 5 revolved around name changes … kind of… while some names did “change”, others just had their case made consistent (.Normal became .normal)…

But those changes (to me) were/are a lot less “painful” than dealing with API2.0

Not really. I‘m no expert, but they had clearly stated that the language was still going to change (as it did) - though with version 5 they finally reached some important milestones, eg ABI stability, see

The changes from one version to another are annoying since old example code may or may not work :frowning:

Its the same issue API 2 imposes on Xojo code - every website with code that predates API 2 may, or may not, work. Same for every xDev article, Bobs training, etc etc etc

BUT as Dave said the vast majority, if not all, have been automagically handled by Xcode
Xojo has more difficulty doing that unfortunately