So you want to be an iOS developer! You’ve heard of Swift, but you’re not quite sure whether it’s the right programming language for you. In this guide to Swift we ask veteran iOS developer Andrew Madsen, who now leads Lambda School’s remote iOS Major, all about the iOS language Swift. We’ll cover the origins of Swift, the difference between Swift and Objective-C, and what the future looks like for the world of iOS programming. Plus Andrew gives some examples of apps built with Swift, and a few great suggestions to start learning.
THIS GUIDE EXPLAINS:
- The Origins of Swift
- Why Should I Learn Swift?
- Apple frameworks you’ll need to know as an iOS Swift developer
- Examples of Apps Built with Swift
- Up Next: iOS trends on the horizon
- Resources for beginners who want to become iOS developers
Andrew has been doing development on Apple's platforms for 13 years – starting with the Mac, then jumping into both iOS development and Swift right when they were released. He worked as a full-time developer until two years ago when he took over the iOS program at DevMountain. Now he’s building out the iOS Major at online school Lambda School.
The Origins of Swift
What do you think has fueled the growth of mobile-first development over the last decade?
When the iPhone came out 10 years ago, I don't think anybody knew that it would be so huge. Of course in hindsight, it seems obvious – people are now carrying around a computer in their pocket that has access to all the world's information. For that to be possible, developers are writing software that enables those experiences and solves everyday problems.
What is Swift?
Swift is a programming language created by Apple in 2014. It is used for building apps for Apple’s platforms, and has expanded to being usable on other platforms including Linux, as well as for creating web apps. Swift is intended to be easy to start learning, but to scale so that it can be used to develop large, high performance, complicated applications. It has a friendly, approachable syntax, and a lot of features that make it an ideal programming language for the practical work of building mobile applications.
Swift takes good ideas from many other languages. It includes full, first-class support for object-oriented programming, and includes many features found in functional programming languages. One unique feature of Swift is its emphasis on protocols. Apple has described Swift as “the first protocol-oriented programming language.” Swift’s deep support for protocols means that programmers can build the kind of complex systems typically built using object orientation without some of the problems inherent in object-oriented programming.
Swift has a strong, static type system which allows the compiler to catch many bugs during development instead of them showing up in a running app. Its inclusion of rich value types gives programmers another way to write code that avoids common bugs seen in other languages.
Objective-C was the first language used for iOS development. What was it missing and why was Swift developed?
Objective-C started in the early 1980s, and has been used for developing apps for all of Apple’s platforms since about 2000. It's an old, but very powerful language. While Objective-C was state-of-the-art and really innovative at the time, 30 years later we've learned a lot about how to build programming languages and learned from the mistakes of the past. Computers are more powerful, which allows for more sophisticated programming tools.
By 2010, iOS became so big that it attracted hundreds of thousands of developers, and Apple started to see common problems in iOS apps. Many of these problems were due to the fact that Objective-C made programming difficult. It’s easy for new programmers to write bugs in Objective-C. Apple took all of the lessons they learned to create a language that solves a lot of these pain points. Swift is safe, harder to write bugs, it’s concise and really expressive, and easy to read and write. At the same time, it’s still performant, really good for writing apps, and still interoperates with Objective-C. Swift takes a lot of features that have been introduced in other languages and brings them into the Apple ecosystem.
How has Swift been adopted since it was announced in 2014? Is there any reason to learn Objective-C for iOS at this point?
It's been almost four years since Swift was released. In the last four years, Swift has seen really wide adoption. My hunch is that the majority of iOS developers are using Swift. That said, I still think iOS developers should learn both. We will be covering both Objective-C and Swift in Lambda School's iOS Major.
I think it's vitally important for iOS developers to learn Objective-C. Although they're unlikely to be writing it every day, they need to be able to read code that was written in Objective-C because any company more than three or four years old will have Objective-C in their codebase. If nothing else, you’ll see it and need to be able to write Swift that interoperates with it.
If you work for a brand new startup, you can probably get away with only knowing Swift. But even the frameworks that Apple provides for you to write iOS apps are themselves written in Objective-C. So even if you think you’re living in a Swift-only world, you're really not. You're taking advantage of Objective-C and Swift's ability to work together.
I don’t think this should scare beginners, though. You can go a long way learning Swift and iOS development without touching Objective-C. Then, when you’re ready, you can learn a little Objective-C. While Objective-C and Swift are different languages, they have a shared pedigree, and Swift takes a lot of inspiration from Objective-C. In my experience, a Swift developer can learn to read enough Objective-C to get by without too much trouble
Why Should I Learn Swift?
Do you think that Swift is a good first coding language to learn? Is it good for beginners?
I actually think Swift is a great first programming language, and that’s not a coincidence. When Apple was developing Swift, one of their goals was to be more approachable for beginners than Objective-C was. I love Objective-C and consider it my “native language,” but it's certainly not an easy language to break into if you've never programmed before.
Swift is designed to be much more friendly to beginners. It's still a really powerful, deep language and will take you a long time to master, but you can sit down and learn some of the basics within an hour.
Can I learn mobile development before I learn web development? Or do I need to learn web development first?
You can certainly be a mobile developer and not do web development. I’m an example: I am not a web developer. I'm an iOS developer and a Mac developer. I've seen students over the past three years who start with no engineering experience, learn iOS development, and get a job. They never do web development.
At Lambda School, we want education to be accessible, so you don’t need to know a programming language – web or mobile – before you apply.
What do you think of the debate between Native iOS (Swift/Objective-C) vs Mobile-Friendly Web Apps vs React Native?
There is a philosophical debate between native app development and mobile web apps. Why teach Swift or native iOS if people can just put together a web app? The very best experiences are developed natively, so if your goal is to provide the best experience possible for your users, then native development is the best option. We see that in the industry, where most of the apps that users truly love are written using native development tools, which means Swift or Objective-C on iOS.
People are attracted to React Native because they want to write an app for Android and an app for iOS with the same codebase. We think that's pretty interesting. At the same time, I know a number of people who are doing React Native, but they're all people that are also native iOS developers and they say that they still have to use their iOS knowledge even when doing React Native. There are things that are hard to do with React Native that are easy with regular native development in Swift.
The idea is that you learn React Native and you can write code that will run on either platform, but it turns out there is still a fair amount of work to make just one single codebase run well on both platforms. From what I've heard, you still have to know how native iOS development works to use React Native because in some cases React Native doesn't do what you need to do, and you have to write code that requires you to understand the platform you're on. I think the best React Native developers are also native iOS and Android developers.
Apple has already done a lot in terms of Swift education. Why does somebody need a coding bootcamp or a program like Lambda School to learn Swift?
I’ve been really impressed by Apple's Swift curriculum – in fact, Lambda School’s VP of Instruction, Caleb Hicks, and I both worked on curriculum for Apple. But it's primarily meant for kids to get an introduction to programming and to light the spark for them. It teaches you how to develop iOS apps but it's certainly not fully preparing you to go work in the industry doing professional iOS development. Lambda School is intended to do just that. We expect you to graduate from Lambda School and to be able to get a job doing iOS development.
Beyond that, a little more philosophically, I think that self-learning is great and can be a really good option for some people. For example, I'm a self-taught programmer – my degree is in electrical engineering and I taught myself to code. But one thing that a coding school like Lambda School can provide is a lot of help and guidance. It's not up to you to figure out what to focus on, because you've got somebody guiding you who actually knows what they're talking about.
In a class, you’re also working with other students, which is valuable because you have an external motivation. When things are tough or you get stuck, you're going to keep going because you’ve got classmates. Learning how to program is hard, and it’s almost impossible to spend an hour here and there learning to code. You have to put focused effort into that goal, which is hard to do on your own. The structure of a coding program can be important to push through that barrier to entry.
Apple frameworks you’ll need to know as an iOS Swift developer
There are a lot of iOS frameworks but there are a few that every iOS developer needs to know, and we’ll be teaching these in the Lambda School course. These are all first-party frameworks that Apple provides, which means they keep their documentation pretty comprehensive and up-to-date.
- UIKit: the primary user interface framework for developing on iOS. Any native iOS app will be using UIKit for all of its user interface.
- Foundation, which provides lower level data structures with Swift and Objective-C. If you need an array, or a dictionary, or you need to be able to handle text, or dates, Foundation does that for you.
Optional but Popular:
- Core Data saves data. If your app deals with any kind of data that it needs to save to the phone, then you’ll likely use Core Data.
- MapKit and Core Location for developing location-based apps. MapKit is used for displaying maps in your app. If your app needs to use the phone’s GPS, Core Location is your framework.
- Core Motion to detect motion on the phone. If your app needs to use the gyroscope or the accelerometer, it will use Core Motion.
- Local Authentication framework is important if your app uses Face ID, Touch ID or requests the user’s passcode.
- Others to check out: Core Graphics, Core Bluetooth, Core Audio, Core Video, AVFoundation.
What will Lambda School teach in the new iOS course?
I have been working in iOS development as long as it’s existed, so I feel like I have a strong handle on what’s important in this industry. I've also received feedback from people in the industry and employers. I'm synthesizing all of that feedback into the curriculum here. The iOS Emphasis will be part of Lambda School’s Computer Science Major, and will include:.
- Swift and Objective-C
- UIKit fundamentals - how to actually put objects like buttons and text on the screen and make them react.
- Table views, which is a common UI for the iPhone.
- Persistence, which is saving data using frameworks like Core Data.
- Networking – nearly every iOS app needs to connect to the internet, talk to servers and pull data from them.
- Custom user interfaces that look good, work well, have nice custom animation, etc
- Code Quality, meaning debugging, unit testing, test driven development, UI testing. These are practical skills that make a developer really good.
- Development on Apple’s other platforms: macOS, tvOS, watchOS
- iOS app architecture
What makes a Senior iOS developer vs a Junior iOS developer?
One of the things that differentiates a junior developer from a mid-level or a senior developer is their intuition around architecture. When given a problem, junior developers know how to solve it. But mid-level or senior developers can say, “I know how to solve this problem in three or four ways, but I also know how to pick the best way – the way that's actually going to be maintainable and extensible and perform well."
In my opinion, there is no substitution for experience in the industry. Junior developers go to mid-level and then to senior developers when they have experience working in the industry. We certainly want our graduates to be the most qualified new iOS developers out there, but I’m not ready to say that students who graduate from Lambda School will be senior developers. I'm an experienced developer myself and I really love the deep stuff and the abstract stuff that makes someone a senior developer, so I'm really excited to get to teach more of that.
Many courses are 12 weeks long and aim to get their students ready to be junior developers. One of the things that excited me about working at Lambda School is that I get to teach 15 weeks of iOS curriculum and 10 weeks of computer science along with a 5 week real-world iOS capstone project. Lambda School wants to replace a university CS education – that's our goal.
Examples of Apps Built with Swift
- Lyft was one of the first major apps to go all-in on Swift, rewriting their iOS app from scratch in Swift.
- Airbnb was another company that started using Swift really early on, and has talked about the improvements they’ve seen from using Swift.
- MeasureKit is an augmented reality app for measuring anything. It’s a really clever use for augmented reality.
- Blackbox, which is a game that could only be done on mobile. It takes full advantage of everything a mobile device offers – the accelerometer, the buttons, the microphone, the GPS, etc.
- The Swift community continues to grow, and hundreds of iOS apps written using Swift are released or updated every day.
Will students at Lambda School build a real app during the course?
During your last five weeks at Lambda School, you will work on a project with Lambda Labs. This is your capstone project, and it’s fully specced out by Lambda. The experience will feel like your first day at a new company, being thrown into a project and starting to contribute from day one. At Lambda School, we are trying to give students a taste of actually working in the real world. They're doing daily stand-ups, working in Git, working through a queue of issues. But our instructors also very hands on. We don’t just give students a video. They're in class from 8am to 5pm every day working with instructors and mentors. It's remote, but it's still very hands-on and immersive.
In order to graduate, you have to build an app and put it on the App Store. That’s a serious endeavor, and take a lot of time and effort, but students will get there. We think that's really important because most iOS development jobs won’t even look at you if you don’t have at least one app on the App Store. You can show a potential employer real, shipped code that they can download on their phone and test.
Up Next: iOS trends on the horizon
For iOS development specifically, augmented reality is pretty cool and getting a lot of attention from (and outside of) Apple. Gaming is an obvious industry that augmented reality fits into, but it also has more practical applications.
Apple hosts their developer event every June, where they announce new frameworks and new technologies (that’s where they announced Swift four years ago). Apple keeps things close to their chest, but there are pretty strong rumors this year about a way to write apps that will run on iOS devices and the Mac without having to completely rewrite them. Right now, if you want to adapt a Mac app for mobile, you’ll have to rewrite that as an iOS app. The Lambda School curriculum includes a Mac development module, which is a calculated decision.
Resources for beginners who want to become iOS developers
Apple's curriculum is a really good place to start. Their app Swift Playgrounds is a really fun way to start, even though it's partly targeted towards kids.
Programming is all about creativity and getting a computer to do what you want to do. Programming is a hard field to get into, but at its core, it's about breaking a problem down into simple steps that you can teach a computer how to carry out, and you can practice that with the Swift Playgrounds app. If you like that, then you probably will enjoy being an actual developer.
Lambda School also has a free, two-week iOS 101 course that anybody can sign up for.
How to Get Into 7 Coding Bootcamps
Reps from 7 bootcamps give tips and tricks for the coding bootcamp interview and coding challenge.
Where Are They Now?
Bootcampers 3 years later...
What We Built At Coding Bootcamp
Flatiron School grads Eva & Saige show us their fully functional final projects!