Jump to content
  • entries
    295
  • comments
    862
  • views
    242,355

Swift 3 catch 22

EricBall

623 views

Last night I told myself to stop playing Minecraft and get back to work on my iOS game. At least start to put together the level editor. Once I have something partially working I'm much more likely to spend time working on it.

But XCode had other ideas as it had updated. So when I opened the project, it asked me (twice) whether I wanted to convert it to the current version of Swift. I said no, but then it said it wouldn't be able to compile it. That wasn't a good option either. So I made a backup of the project and told it to convert it to Swift 3.

For the most part the change from Swift 2.2 to Swift 3 is cosmetic - more consistent method naming (like fixing stdio.h so fputs parameters are stream then string order). But I found one Catch-22.

In my game I'm using an OpenGL fragment (pixel) shader. To pass a variable from the main program to the shader it's put in a "uniform" - a special kind of variable. Uniforms have special types to match OpenGL types, vectors in particular. The commands to create these these vector uniforms is different in Swift 3. That wouldn't be a problem except the commands aren't supported by iOS 9 for some reason. So while I'd like to use Swift 3 in case I need to make code changes in the future, I also want to support iOS 9.

So for the moment I've gone with Swift 2.3, which XCode will compile.

And I still haven't started coding the level editor.



3 Comments


Recommended Comments

While going with Swift 2.3 was okay for my existing projects, I couldn't easily create a new Swift 2.3 project.

 

Fortunately, you can download old versions of XCode and rename them as part of the install. So now I can go keep developing using Swift 2.2 for iOS 9 without issues.

 

It also appears the big downloads last month was XCode updating itself on my macBook and iMac.

Share this comment


Link to comment

Drat, drat, drat. I remembered (and verified) in order to submit to the App Store, the app must be programmed with Swift 2.3 or 3. So I guess I'll need to figure out how to get everything upgraded without breaking it too much.

Share this comment


Link to comment

Looks like Swift 2.3 is now "deprecated", so I will need to upgrade the code to Swift 3 to submit it to the app store. (Assuming I manage to shake my funk and get enthusiastic about it again.)

Share this comment


Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...