Xcode 6 and SWIFT


From the 2014 WWDC

Apple unveiled the new programming language that it wants developers to use in making iOS and OSX apps this week. This sent me scrambling to a place where I could download large files for free (not my house) to get the new version of XCode so I could try it out. I also liked the idea of starting on the ground floor with every other developer on the day it was released.

About 24 hours later, I finally have the new XCode beta downloaded and installed on my computer (storage space on my MacBook Air is always at a premium). I have not yet been able to install the new iOS on my phone because I simply have too many pictures cluttering up the storage space there too – I’ll deal with that later, when I can hook up to my external drive – and I have not been able to download Yosemite yet for some other reason. I know this isn’t the storage problem – at least not yet. But I still haven’t worked out the kinks on that one.

So… what can we expect from this new SWIFT / XCode combination? One thing that I’m certain a lot of people have been looking forward to, is a more integrated coding space. Bret Victor gave a talk at the 2012 CUSEC (Canadian University Software Engineering Conference) presenting this idea in a pretty solid demo that illustrated everything from side-by-side coding and output for graphics and even a simple sorting loop. In both examples, we see how easily this kind of work environment leads to debugging before you are even finished typing in the buggy line of code.

I was going to clip a section of the talk to show the moments where Bret really nailed his idea, but the whole talk is just so remarkable, I suggest you watch it all – if you haven’t already. And if you have, watch it again. It’s that good.

Back to today…

Does this mean that I’ve been cranking out new Swift code all day? No. Sadly.

There’s a couple (maybe three) roadblocks in place for me before I can do that.

  1. Even though I have XCode up and running, I can’t figure out how to start playing with Swift in the playground.
  2. I have studying for that Chemistry content exam I need to take.
  3. I keep getting distracted by writing posts for my blogs.

That said. I’m back to it. By the way, I really have to hand it to KhanAcademy. It’s made studying a much more engaging pursuit. I highly recommend this site for any student in a class covered by his material.

Here’s a clip of video from the Swift announcement at WWDC. Compare it to what you just saw from Ken Victor.


Transformation – a plan of attack


Click this image to try to catch up with Jason Wellborn – The image was easier to find than the attribution

I have to admit, with yesterday’s release of Apple’s new Swift programming language, it is tempting to try to remake this whole thing as a swift program in XCode. I think for now I’ll stick with C++, but I just downloaded the Swift programming guide from the iBook store…


Project: Transform the clown car simulation into a game of Pokemon.


  1. Make a Draw pile (deck) with all the Pokemon that will be included in the game
  • Use vectors for decks
  • Pokemon each have a name, an ID number, hit points, and three attacks
  1. Make two separate piles (decks) for the player and the computer (opponent)
  2. allow player to select Pokemon from the Draw Pile (select Pokemon by ID number) – select 2
  3. computer selects Pokemon from Draw Pile (randomized, by position in vector) – select 2
  4. Import the player’s and computer’s decks to a battle function
  5. Battle Function
  • Player and Computer select first Pokemon to fight
  • battle function or some other subset function will need to distinguish the two decks as attacker and defender
  • take turns selecting attacks (attack success should have inverse probability  of hit chance and damage done – set base to 50%, then use modifiers to adjust for each attack)
  • be sure to manage hp properly – use clown car model
  • if a Pokemon is reduced to <= 0 hp, it is defeated and that player’s other Pokemon is advanced to fighting position.
  • If second Pokemon is defeated, declare other team winner