Should I learn Objective-C or Swift first?

“Should I learn Objective-C or Swift first?”

I get asked this question a lot. Sometime’s people will also ask about learning C or C++ first. So, I want to take a moment and give you the low-down on how I feel as a professional iOS & Mac developer, six months after Swift’s introduction. If this is your first time here, here’s a little background on me:

About me…

I’ve been developing software for as long as I can remember, at least 20 years now. I never was really the Mac guy, but I liked Linux and was always looking at new technologies. So, when the iPhone came out in 2008, I got myself a Mac and entered that ecosystem. Around that time I learned Objective-C, and that became my primary development language. It has been since then, and I’ve seen the language and Mac/iOS APIs twist and turn this way and that for the past 6+ years. In June I picked up Swift for the first time like everyone else, and although I still won’t call myself an expert, I will say I’ve done extensive study on the language. I’ve developed (and released) 3 apps using Swift since the announcement. Learning Swift is something I think is really important to iOS developers now, in fact it’s critical. To help people out I decided to write my Swift Book. This also serves as a way to help me learn the language, but I have already seen what a valuable resource it is for others; it’s exciting to be a part of… Additionally I’ve worked on an SDK that uses Swift, which will be used as part of a major platform worldwide in 2015. It’s very exciting to ship something like this that so many other developers will be using.

So, that’s my Swift-related experience in a nutshell. Now, here’s how I want to answer your question…

So… Swift or Objective-C?

Part of me wants to say, “Yes, go learn C first and then Objective-C. That’s what I did, so that’s what you should do.”

But here’s the thing: Just because that’s the path I took, doesn’t mean it’s the best path today. When I was first learning C, people told me I needed to learn Assembly to really get what was going on. They told me that without an underlying understanding of Assembly, I was going to be forever writing code and not understanding it. I ended up ignoring this advice and was very happy and successful as a developer without Assembly knowledge. In my college years, I finally picked up Assembly as part of my Electrical Engineering degree program. It helped enlighten some things, but for the most part I don’t feel knowing Assembly had much of an effect on my day-to-day programming. It had no effect on how I separate objects, how I decide what gets encapsulated, where to inherit, or where to compose. Most importantly, it didn’t help me to build better software. It was basically just academic, and as interesting as it was and is, the only place it’s even remotely relevant day-to-day is in debugging or reverse engineering; and only in limited capacities.

There’s certainly some sort of fear in me, like if we don’t all learn Assembly it will become a lost art. But, I don’t think that’s a realistic concern, honestly. The more I think about the idea of Assembly becoming a lost art the more I realize it will never happen. A single preserved book on the topic can get anyone where they need to be to be productive in Assembly, you just probably don’t want to.

Computer Science is an industry where we need to let go of the past, and we need to do it as quickly as we can. This industry is not going to wait for you to learn all the languages leading up to the latest and greatest. The marketplace certainly won’t reward that. What it will reward though, is knowing how to write code to make working software. That’s sort of the general thesis of this site, and it’s why I produce it. I don’t want to teach you to write code; I want to teach you to make software.

So here’s my answer to your question:

Swift

You should learn Swift first. You should learn it first because it’s the future of development on Apple platforms, and frankly it’s just easier to understand than Obj-C or C. What you may find as you learn it is that the Cocoa framework is getting a little stale. It’s starting to look very much like an Objective-C API in a Swift world. But that’s probably going to change. This wouldn’t be the first time Apple made a major change to their underlying APIs. Back in the days before Cocoa developers used Carbon, a C-based API that had some interoperability with Objective-C.

Apple is well-known for making swift (get it?) changes to their development stack. The move from Mac OS 9 to Mac OS X is a great example of their commitment to innovation. As a developer on Apple platforms, it’s important to understand this fact. Apple is about building the future of technology products, and they are not afraid to forego backwards-compatibility in order to achieve that. If you are still writing Objective-C day-to-day, you’re writing legacy code at this point. If you are writing Swift, then welcome to our world, you are the future.


Sign up now and get a set of FREE video tutorials on writing iOS apps coming soon.



Subscribe via RSS

8 Great Open Source Projects to use in your next iPhone App

I’ve scoured the internet looking for great open source iOS apps, and what I determined is that what is really more interesting is the open source iOS components and frameworks. So here’s my list of the most useful open source iOS components.

8. PSCollectionView
PSCollectionView is a custom collection view that allows for the easy creation of Pinterest-style image collections in your iOS apps. Source on Github

 

7. GMGridView
This little grid view library allows for the simple creation of highly interaction view sets. You can see a nice video of an example result hereSource on Github

 

6. PRTween

PRTween is an extension of the core animation framework. It is an effort to take the power of core animation, and make it easier to use. The commands available may remind some of the stupid-simple jQuery animation commands like fade, hide, or show. Source on Github

 

 

5. iHasApp
I recently was asked by a client if we could detect their other apps installed on the device, and if the user didn’t own them if we could have the app present cross-promotional ads. I wasn’t sure what the answer to their question was, it seemed like something that might fall under the dreaded “private api” category. But here this project is an App Store friendly library to detect other apps installed on the user’s phone. Source on Github

 

4. NUI
NUI is a very interesting project that aims to make styling of iOS apps as easy as styling in CSS. Take a look at the syntax on the project’s github page and you’ll see what makes this such an interesting project. Source on Github

 

3. grabKit
If you are writing an iPhone app that involves the user’s photos, one thing that’s always a bit tricky is adding support for all the various social networks that the user might prefer to host their photos on. grabKit makes this easier with this drop-in library that let’s the user import photos from Facebook, Flickr, Instagram, Picasa, or the iOS device itself. Source on Github

 

2. MultistrokeGestureRecognizer
This library is great for anyone creating a very touch-centric game, or any app that uses lots of complex gestures. The library is based on the N Multistroke Recognizer which is a great algorithm for detecting very complex touch gestures. If you remember the gestures in the game Black & White, it’s kind of like that. Source on Github

 

1. Filepicker
Similar to grabKit, Filepicker allows for the importing of files from various social networks, but also includes many more services such as Dropbox, Gmail, and even Github. The library is also not limited to only photos but can be used for a range of content types. Source on Github

 

Honorable mention: cupertino
Cupertino is not an iOS library, but rather a ruby gem that allows for administration of your Apple Developer Account. This has been a missing piece of the formula for automating iOS development work for years, so I’m glad to see some hackers have decided to take up the challenge of making a CLI for the Apple Developer Account system.


Sign up now and get a set of FREE video tutorials on writing iOS apps coming soon.



Subscribe via RSS