in Swift

Swift Meetup, August 12th, 2014

Thank you to everyone who attended the first ever @CodingInSwift meet up last night!

It was great to see so many local developers taking an interest in the new programming language and I enjoyed getting to speak with so many people from different technical backgrounds.

We be holding another meet up in three weeks time (stay tuned for details) with a more on hand focus and Swift programming.

In the meantime, if you missed the meet up or would like a copy of the presentation, you can download it here.


Screen Shot 2014-08-14 at 6.36.42 PM

Thanks and I look forward to seeing you at our next meetup.

Here are some images from our event.



Remember to sing up for our Coding in Swift Meetup.


Coding In Swift – Winners Announced

swift-book-150x150Our @codinginswift contest has come to a close, and we’re ready to hand out some prizes!

On July 10th, we passed 1,000 followers and announced this contest, in which 5 of our followers would receive a $25 iTunes gift card and one lucky follower would win an iPad Mini.

So, without further adieu, the winners of the $25 iTunes gift cards are:


The grand prize, an iPad Mini(non retina), will be going to: @SwiftNinjaiOS

We ask all winners to contact us at info[at] with their postal address and allow a few days for us to process prizes.

We want to thank everyone who participated, and invite you to like our Facebook Page, where we will be having another contest when we reach 10,000 likes.

Finally, we invite all Bay Area developers to join our meetup group and take part in our upcoming Swift meet up on August 12th, where we will have more prizes, pizza and beer.

Bouncing Soccer Balls in Swift


Nothing fancy, nothing complicated, just a simple sample of some bouncing soccer balls in Swift. To start off, create a simple OSX Application under New::Projects. Under OS-X choose game




Screen Shot 2014-07-16 at 7.29.34 PM

Then on the next screen add a product name, and choose “Swift” as the language. And for Organization Identifier, the usual com.yourname. syntax.

Screen Shot 2014-07-16 at 7.29.22 PM

When you hit next, Xcode will create a game project for you. Go and click on the GameScene.swift file and let it open up on the editor.

Replace the source with the following source code.

Add the soccer ball image (named soccer_ball.png) Drag and drop it into the folder created on the top level as yourGameScene.swift and as shown on the following image.

Screen Shot 2014-07-16 at 7.32.36 PM

(If you want the soccer ball, the easiest thing that you can do is right click on the soccer ball at the top of the blog, choose Open Image in New Tab, and then on the new tab, drag it to your folder or desktop and then add it to the project via drag and drop and you should end like the image above).

Here is a short video of how it should end up looking like.

Let me know what you think, and enjoy.


Swift Folder Icon

Swift language logo

Like a lot of you reading this post, I have been experimenting and writing Swift code and one thing that found annoying was a lack of visual identifier for a folder for Swift related code and snippets. So I went ahead and in my feeble attempt, I created a Swift folder and after using it for a while I found it very useful and thought that you may find it useful as well.




Here is a snapshot of what the folder looks like

Screen Shot 2014-07-15 at 5.05.08 PM





To download the png click [here]. I will assume you know how to change the folder icon…

Thanks and I hope you enjoy it.


We just broke 1,000 followers on @CodingInSwift

Swift language logoOur @CodingInSwift Twitter page recently surpassed 1,000 followers. To celebrate that superhuman feat, we will raffle off an iPad Mini (16 GB) on August 1, just to show our appreciation to our fellow Swift language newbs.

Specifically, we will pick a random Twitter follower of ours to get the iPad Mini — if we pick you and you confirm your existence, we will send it to you. All you have to do is pay $500 for shipping and handling.

Just kidding!
You won’t pay a cent…. Unless you really want to.

Now, the only rules that we can think off (thanks to our lawyers) are that you must be over 18 years of age, must pay any local/state taxes for the iPad Mini, and must have a valid shipping address. If we pick a winner outside of the United States, the country of destination must not be a embargoed country where we can’t ship the device. Pretty simple — just the way I like it! And if you miss out on this one, we’ll have an even bigger giveaway when we break 10,000 likes on our Facebook Page. :-)

Other than that, I want to sincerely thank all of you who have been following us, retweeting or favoriting our tweets, and continuing your contributions to the still-nascent Swift developer community as a whole.

For those of you who have emailed me about meetup and workshops, those are coming up soon. Since the Swift language still evolving, we don’t want to plan a workshop or meetup and then have them change in a matter of days, like they did back during the Xcode Beta 3.

Lastly, along with the aforementioned iPad Mini winner, we will also pick an additional five (5) followers to receive a $25.00 iTunes gift card. That can buy you a couple dozen 99¢ iOS apps — or an infinite amount of free iOS apps!

To stay on top of our latest plans, be sure to join our meetup group and our online forum, which now has almost 300 links to Swift tutorials, blogs, articles, and videos.

Can you believe I went an entire blogpost without making a “swift” pun?

Minimalist Sublime Text Swift Build

Thats a funny title.

Now updated to reflect XCode6-Beta3

If you are like me and sometimes are in a mood where you don’t want to deal with starting up terminal, and/or, dealing with vi, I went ahead and did a quick and dirty build script for Sublime Text 2.

Am assuming you have ST2 downloaded, and are pretty good at it. If not, is ok. Follow these steps for Swift builds under Sublime Text 2


Tools->Build System->Build New System

Sublime will create a blank file called untitled.sublime-build with the following information


Replace the above with

Save as

Sublime will save it in its packages:users folder.

If you just updated to XCode6-Beta3 then use this

Save as

That is it :D

Then once saved, write some Swift code and Command+B and it should magically works.

Here is my sample output. Now, who is willing todo the Swift Sublime color syntax highlighter.
Screen Shot 2014-07-03 at 4.53.58 PM

As usual, let me know if I missed anything or how to improve.

Also, unless otherwise indicated, this will most likely work under Sublime Text 3.





Getting Git running on Yosemite

Recently, I tried running git from the command line and I got an error from XCode as follows

Screen Shot 2014-06-24 at 11.31.40 AMWhich brought up this dialog, and thinking that clicking on install will do something, well….

Screen Shot 2014-06-24 at 11.25.43 AM

Finding the software…

Screen Shot 2014-06-24 at 11.25.53 AM

And it FAIL…..

Screen Shot 2014-06-24 at 11.26.41 AM

Then it dawned on me, duh, I hadn’t installed Git. (Having to switch between Mavericks and Yosemite…) So I went ahead and downloaded Git from and once the packaged is downloaded, I double clicked on it to install Git, and sure enough, you can’t, because it is from an unidentified developer.

Screen Shot 2014-06-24 at 11.29.54 AM

System Preference’s Security & Privacy panel to the rescue. Click on “Open Anyway”

Screen Shot 2014-06-24 at 11.30.10 AM

But that’s not all folks. If you run Git on the command line, it will not launch, you will be back at the xcode-select error. (See the first image).


So, dust off your vi and start a vi session


vi ~/.profile

Then add

export $PATH

Once you do this and have successfully saved your profile settings, remember to start a new terminal session so that the changes take effect. To verify that it works after a new Terminal session has started type Git on the command line and you should see the following

Screen Shot 2014-06-24 at 11.32.35 AM


And you are done. We have successfully installed Git on Yosemite. If you have comments, or I missed a step, let me know.



Swift iBooks in PDF format

I love Apple and their iBooks reader, but sometimes, it is good to have a version other than iBooks to read on a non Apple device, therefore, I converted both The Swift Programming Language and Using Swift with Cocoa and Objective-C into PDFs. Click on the corresponding covers to download the pdf book desired. Apologies in advance but due to the conversion, formatting gets a bit funky, but it is all there.

*NEW* Apple updated the Swift Programming Language manual to reflect the changes on Beta3. Here is the link to download the updated PDF and its release notes directly from Apple, [Click here to download from Apple] (the PDF link is on the top right of the page).

The Swift Programming Language below is the one Apple first release when they announced Swift. Using Swift with Cocoa and Objective-C was not modified for Beta3.

Screen Shot 2014-06-19 at 6.20.37 PMScreen Shot 2014-06-19 at 6.20.22 PM












Remember to follow @codinginswift, like us on facebook/codinginswift and join our meetup group Silicon Valley Swift Programming Group.



To Objective-C or not Objective-C

swift-book-150x150It has now been almost two weeks since Apple released the Swift programming language and after the initial hoopla and everyone chiming in on what language it most resemble, and as the euphoria begins to settle and realization begins to finally sink in, I am seeing two camps with opposing views as to what should you learn first.

Drew McCormack tweeted “Intriguing that non-devs seem to perceive learning Swift as being much easier than Obj-C. I guarantee it is much, much harder. C++ hard.” see his tweet. The tweet has gotten quite a response.

And yesterday, June 11th, Aaron Hillegas, blogged that “iOS Developers Need to Know Objective-C”, (read his blog here) and by reading the comments left on the blog, it got quite heated, vocal and accusatory. Aaron has authored numerous books on iOS development.

On the other hand, we have newcomers, who look at Swift and have fallen in love at how ‘easy’ and ‘readable’ Swift is. Some are comparing it to JavaScript, others to Scala, Haskell and Rust. Clearly, Swift ‘borrowed’ heavily from all theses different languages and others, as stated by Chris Latnner on his webpage. And Apple’s Xcode playground, makes Swift look like an leisurely afternoon walk in a balmy day in Central Park.

This battle fronts remind me of old Apple Windows ads of “Hi am a Mac, Hi am a PC”, but now we have “Hi, am a Swift Programmer, Hi am an Objective-C programmer”. (Maybe I can get my crew to come up with some clever sarcastic videos depicting said programmers).

What do I think?

There is an element of truth to the fact that you need to have some prior experience in programming in order to dive into Swift. I have been looking at it for a week now just like all of us are doing at the moment, and I have to say, that I find some of the language semantics easy on the eye, some others, not so much. Don’t get me started on the notion that you can use emoji’s as variable names. Just how many poop emoji variables can one have in a page. Yet, it makes the integration with the cocoa and other frameworks more palatable. And that is the point, I think that just ‘learning Swift’ is not going to make you an Mac or iOS developer. It is about the framework and learning Cocoa, SpriteKit, CloudKit and the hundreds of other Objective-C frameworks out there to integrate with Swift is what I think is necessary. And lets not forget the millions of C++ lines of existing code out there (on top of the other million Objective-C code), as well as pure raw “C”.

All hail the great “C” language which is almost nearing 50 years of age and it wont die. (oops sorry I digress).

If you want to be an iOS/MacOS programmer and want to write super cool apps, and If you don’t know what NSWindow, NSObject, NS…. is, well then, Swift is just going to be just as useful as a Zambonie at a Football field. During WWDC, Nate Murray wrote a Flappy Bird clone within 24 hours of Swift being released, calling it FlappySwift. (click here for git). Am pretty confident that Nate knows his Cocoa Frameworks pretty well, and am willing to sate, he knows his Objective-C well enough to have gotten FlappySwift off the ground in hours.

The barrier to Mac development got easier (?) with Swift, but there are all the intricacies we have come to love/hate over the years that we have had to struggle with and learn. The new crop of Mac developers (new being the key word here) who will think using Swift is going to be easy, are in for a quite a treat. And don’t get me wrong, I am as enthusiastic about Swift as all of you are, but some of my thoughts here are based on my experiences as a developer.

I could go on, what do you think of developers learning Objective-C first then Swift, or vice-a-versa?

Thoughts welcomed,




The Swift Language


codinginswiftpanelLast week, June 2nd, Apple announced a new programming language called Swift.

As I watched the Keynote, I turned to one of my colleagues and said something to the extent that Apple would introduce a new language and new graphic features. And I was right. It was about time for a new easier and more palatable language than Objective-C. Now Objective-C is not going anywhere. There is a ton of legacy code and if we have learned anything from the past, is, that if it works and it is shipping, there is no need, cough, cough, cough, to rewrite it. Swift is a very nascent language, there is a lot of excitement around it, I am excited about it, but Objective-C is not dead and will not be dead five years from now. It may not be Apple’s official language, but like C, the language will not just go poof and disappear.

Having said that, I saw, seen, and am experiencing the same level of enthusiasm as all of you who are currently knee deep in shit in swift. Love all the comparisons to every language out there, Rust, Erlang, C#, Go, Haskell, Javascript. Missing are Forth, Fortran, Cobol, C and C++. ( just kidding guys ).

And with that enthusiasm, I started a twitter channel for all things swift related, a facebook swift page, meetup group, and a forum. And I invite you to follow us on twitter, like us on facebook, join our meetup, and discuss swift language and other languages over at our forum.

Twitter :




Thanks and expect all sorts of swift programming updates, tutorials, learning courses from me and my group of crazy die hard language fanatics from all sorts of language backgrounds.

Feel free to reach out at cicaza [at] carlosicaza [dot] com (you know the drill on emails). And if you want to help us in any way shape or form, by all means I welcome that.

And with that, go follow @codinginswift, like us on facebook and join our meetup, and ask away at our forum.