Accidental Technologist

Musings about Entrepreneurship, Technology and Software Development

  • Home
  • About
  • Still River Software
  • Privacy Policy

Powered by Genesis

You are here: Home / Swift / Welcome Swift, I’ve Been Waiting For You

Welcome Swift, I’ve Been Waiting For You

June 13, 2014 by Rob Bazinet 2 Comments

Tweet

Swift hero

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 programming language, Swift. ?No one saw this coming.

I?ve been a long-time Objective-C developer but have never been in love with the language. ?As Apple developers, we use because it?s the only real option?until now. ?Swift is introduced as an alternative to Objective-C, not a replacement, and to me resembles Go and C# with many of the language constructs. ?I?m not going into the language details today but you can find out more from The Swift Programming Language guid in the iBooks Store.

Swift is a type-safe and modern programming language for Cocoa and Cocoa Touch applications, which means targeting iOS and OS X. ?It?s really nice to see Apple making big changes and offering developers a choice. ?I?ve read tweets and other reactions to Swift and asking why we need another programming language but I say it?s a good thing. Swift does away with all the square brackets ([]) and pointer references to create a cleaner programming language. ?

Should You Learn Swift?

Objective-C isn?t going away any time soon. Apple realizes Objective-C has baggage and when looking at adding to the language, there is only so much they can do with it and therefore came up with a language that removes all of the warts on Objective-C. ?The API?s are the same when using Cocoa and Cocoa Touch so if you are an Apple developer already, you are half-way there.

Apple releasing this new language says a lot; it expresses Apple?s intentions. ?Swift will be important in the future, whether that?s a year or five, we just don?t know.

Yes, I think you should learn Swift. ?If you are new to Apple then you have a choice, Swift or Objective-C. ?Aaron Hillegas, long-time Objective-C proponent, thinks developers need to know Objective-C. ?He has some valid points:

You can’t do everything in Swift. For example, if you want to use a library of C++ code in your application, you will need to talk to the C++ objects from Objective-C. Swift can call C functions, but I believe that if you are working with a lot of C functions and types, you will want to code in Objective-C.

He claims Objective-C is easier to learn than Swift. ?I?m not sure I agree with this point:

C is a really simple little language, and Objective-C is a really simple little extension to C. Swift has many rules that Objective-C does not. (I, as an instructor, am already trying to figure out how I will explain the rules around optional variables and the proper use of ? and ! to signal the programmer’s intent around optionality.) These extra rules mean that the compiler can be much more pedantic about enforcing good coding practices, but it also means that the language will take longer to learn.

Objective-C requires programmers to be explicit. The Swift language lets the compiler do more work for the programmer. This is great?less typing for the programmer, right??but it means that when you look at a line of code, it won’t mean much without a deep understanding of the context in which that line lives. Explicit languages are easier for beginners to understand.

Swift has a bunch of constructs that Objective-C doesn’t have. For example, generics make type checking better in Swift, but it makes that language considerably more complex.

Marco Arment had a good follow-up to Aaron?s post and I tend to agree with him:

The time will come when knowing Objective-C will be like knowing C, C++, or assembly ? it?ll be a plumbing layer beneath your application code that almost all working developers will never need to know or interact with. And I bet that time is less than five years away ? possibly just two or three.

I have to say that as far as sample code, blog entries and Stackoverflow threads, Objective-C will have the lead for a long time. ?Finding solutions to problems specific to Swift will be harder to find and you might be a bit of an explorer for a while.

If you are targeting multiple platforms there is always a debate. ?If you go native on every platform then Swift may be a good choice. ?If you like the idea of a single-ish code base then maybe Xamarin (C#) or RubyMotion is something to consider.

If you want to play with Swift be aware that you will need the Xcode 6 beta.

The Future

I am devouring the Swift documentation and WWDC presentations. ?Over the next few months I will be blogging about it, now that I have a good reason to blog. ?

I will not be migrating any Objective-C code bases to Swift?I don?t see the point. ?I will be writing sample code and creating a new application with only Swift and plan to document the process.

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Related

Filed Under: Swift Tagged With: swift

Care about your privacy? I do and use Fathom Analytics on this site.

Fathom Analytics

Recent Posts

  • How to Fix Rails Flash Rendering When Using Hotwire
  • Hotwire Fix for CORS Error when using Omniauth
  • Fix Installation of Ruby using rbenv on macOS Big Sur
  • RailsConf 2021 and the Future of Conferences
  • Fixing Out of Diskspace Errors on Amazon EC2

Categories

Services I Love

HatchBox - Easy Rails Deploys Fathom Analytics
Follow @rbazinet

Rob Bazinet
@rbazinet

  • Just for the record and anyone who might consider it...Godaddy is a complete mess and scammy. I don't think I would… https://t.co/755jpkLbnE
    about 3 days ago
  • This is so true and has been my personal take on people complaining they are busy - https://t.co/YW8NTQLXtl
    about 1 week ago
  • Wow…https://t.co/h94ia053sL
    about 1 week ago
  • My Bills lost today but more importantly so did the Dallas Cowboys. Nice seeing the ‘boys done for the season.
    about 2 weeks ago
  • It looks like the Apple Xcode command line tools is a bit bloated for it to take this long… https://t.co/U0HObTvzXf
    about 2 months ago
  • RSS - Posts
  • RSS - Comments