Swift Development Magazine

View my Flipboard Magazine. 

I have been collecting resources together for everything I come across on Apple Swift.  I add these to a new Flipboard magazine called Swift Development.  If you come across interesting links you feel should be in the magazine, pass them along to rbazinet@accidentaltechnologist.com.

Setup Swift REPL and Access from the Command Line

Swift has a very nice Read-Eval-Print-Loop (REPL) for developers to take advantage of and be able to get instant feedback on Swift code.  This is great for trying things out without having to use Xcode 6 and a full project.

If you are unsure of what this REPL is, from the Swift web site:

Read-Eval-Print-Loop (REPL). The debugging console in Xcode includes an interactive version of the Swift language built right in. Use Swift syntax to evaluate and interact with your running app, or write new code to see how it works in a script-like environment. Available from within the Xcode console, or in Terminal.

The problem is, it’s not available by default since it’s not in your path.  If you have Xcode 5 installed you probably don’t want to have to deal with switching back and forth between Xcode paths.

The solution is pretty simple actually.  I wanted to be able to get to Swift from the terminal with a short command, in this case, swift will be the command.  In order to setup it up I located the swift binary, yours may be different depending upon where you have the Xcode 6 beta installed.  Mine was here:

/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift

If you just run that line in terminal it works fine but I want to be able to access this easily.  The answer is an alias added to the .bash_profile.  Add this line to the .bash_profile:

alias swift="/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift"

Restart the terminal app, type swift and you should see something like this:

Swift term

UPDATE (06/17/2014): Apple released Xcode 6 Beta 2 today and the path changes to where the Swift binary lives, use Xcode6-Beta2.app instead of Xcode6-Beta above.

Welcome Swift, I’ve Been Waiting For You

swift-hero.png

I haven’t blogged here in a while, sometimes life seems to get in the way. Bombshell Last week I was one of many who watched the Apple WWDC keynote and was blown away by many of their announcements.  The one to get me the most excited is the new … [Continue reading]

Speeding up Heroku Deploys

Anyone who deploys their Rails 3.x or 4.x utilizing the asset pipeline and doesn’t precompile those assets yet deploys to Heroku, knows it can take a really long time for your deployment. I searched around a bit and found a great article on how to … [Continue reading]

Subscribe to Posts Via Email

subscribe.jpg

It seems more and more web sites are offering users to subscribe to updates delivered by email.  If you would rather have posts delivered right to your inbox instead of visiting the site or relying on RSS, you can now subscribe and forget. Just add … [Continue reading]

AirPrint Where You Couldn’t AirPrint Before

handyPrint.jpg

Our household has several iPads and iPhones. I use my iPad all the time to surf the web, reply to emails and view my Twitter stream, among other things.  Occasionally I find it would be nice to print from the iPad, since it has AirPrint and all, but … [Continue reading]

How Not To Provide Customer Support

I recently had an interesting interaction with a company’s support team and the results were less than spectacular. Originally, I had a much longer post planned that better detailed the problem, brought attention to the company and gave details of … [Continue reading]

An iPad user tries a Nexus 7

Apple has always been really good at paying attention to the little details, the ones that make their products just that much better than anyone else.  I think people refer to this as being the “best”.  I cam across this great post by Eric Sink … [Continue reading]

One of Many Worlds: Another go at Go … failed!

Remember folks, choose the right tool for the job… You can’t read about programming languages these days without Google’s Go programming language being discussed with much praise.  I agree that Go is good,  but I recently ran across a post addressing … [Continue reading]

What He Said – Tim Bray · Software in 2014

Tim Bray has a great post discussing the state of software development in 2014.  I found myself nodding in agreement virtually all the way through this one, mainly about client-side development for mobile and the web. The client-side mess · Things … [Continue reading]