The Ultimate Guide to Learning Swift and iOS Development
This is a comprehensive guide to not just tools and resources to learn Swift and iOS Development, but also on how to perceive the landscape of programming and provide a mental road map to understanding the advanced concepts that you don’t know about yet. The most common point of anxiety for new programmers is knowing that you don’t know. That’s why I’m here, consider this your free mentoring.
Mentally Preparing for a Tough Journey
Let’s not sugar coat things, programming is hard but not impossible to learn. But it’s important to understand where you fall in terms of programming and your immediate future. You might be a hobbyist or someone who wants to make a career switch. No matter your reasons for learning, do not place high expectations on yourself and your ability to comprehend complex topics. The chances are you won’t make the next big app. However, you might be a part of a great company working on an application you love. Also, the best ideas aren’t created alone, teams work together to make great products.
If at any point in your learning you feel that you are missing a key point and can’t go on to the next topic. Slow down and re-read whatever chapter you are on or re-watch whatever video it is and take the time to solidify what you are learning. Do NOT rush ahead and do NOT beat yourself up just because it’s not clicking as quick as you wish it would. Programming is cumulative knowledge. Don’t cheat yourself out of learning because you have an ego. That being said, we can move on.
Absolutely Essential Tools
Xcode is your only friend. Every once in a while there’s someone who will propose different tools for strange reasons like cross-platform development. If you want to become a C# guy and use Visual Studio, that’s fine. If iOS is your dream, stick to this guide.
You don’t need anything else. If you have an Apple Computer, you can download Xcode on the App Store and you are all set to go. All you need now is a solid guide.
When it comes to Server-side Swift, you will also use Xcode as your main IDE but will need a server to enjoy what you are working on. I’ve currently been experimenting with Perfect which is a web server that allows you to build applications and REST services. There is also Kitura. Note these are web servers.
Swift and iOS Development
Swift is your programming language. In order to be a good programmer period, you need to know your language. It is your toolbox. The better you know Swift, the easier it will be to take problems and construct solutions that perform well and follow best practices. More importantly, by knowing Swift like a ninja, you will be able to develop an intuition on how to construct data models and handle logic. That’s what it’s really about.
iOS Development refers to developing applications using Swift and its various frameworks. What are frameworks, you say? Frameworks are abstractions that allow for generic functionality. As programmers, we often leverage frameworks to achieve the specific functions we want, which are features. The main framework you will be learning at first is called UIKit.
Check this out: Apple Developer Documentation
Consider the above link your most valuable resource. At first, documentation is intimidating, but over time that will change. Take a look and notice how many different types of frameworks there are, and how neatly they are organized into various general categories. Apple has gone to great lengths to make their documentation as user-friendly as possible. Don’t be afraid of frameworks.
So the question is: does a magical book or series of video tutorials that can teach you enough so you can fly on your own? Sure, but it depends on your style of learning.
As far as books go, you shouldn’t have to look any further than this one:
It’s from Apple, the creators of Swift. The way this book is written is very clear, the layout of the book is clean and the exercises are pretty good. Also, it’s free! As far as exercises go, let’s face it book exercises are never as fun as we really wish them to be. So be bold, make your own projects, even get lost in them. You’ll enjoy it more.
If you don’t want to enjoy free content from Apple. There are two great books by Big Nerd Ranch.
These books are very comprehensive. Perhaps even more so than App Development with Swift. To be 100% honest, I have read all three because I believe in practicing the basics. You’ll know you have a handle on this stuff when you can really see the code in your mind.
Now for videos, there’s only one course I have ever found to be truly helpful and videos have never been my thing. They were the Stanford CS193P class videos that are filmed each year and posted onto Youtube.
These 17 lectures are great, college level stuff, and you can definitely get somewhere with them. But chances are, you will end up wanting a book to fill in the gaps.
One final resource you will probably be using is the actual Swift Language Guide. This is a no frills read and might be difficult to digest as the main method of learning Swift but becomes extremely helpful once you are off to the races and need to look up something. If you have experience in another programming language, this is probably the most straightforward way to learn Swift.
So again, check out the Swift Language Guide.
Algorithms and Server-side Swift
If you’re jumping into a job interview anytime soon, you’ll probably want to learn a little bit about algorithms using Swift. Doing so benefits you in two ways:
- You know about algorithms.
- You now understand the value of performance
The one place to go is Ray Wenderlich’s Swift Algorithm Club. It’s a very helpful GitHub resource. When you feel ready, take a look at it and play around with some algorithms.
Also, Ray Wenderlich is one of the best sites, if not the best, for mobile development. There is a lot of great tutorials not just for Swift and iOS but for Unity and Android if you’re into that type of stuff. Don’t sleep on them.
Now Server-side Swift is relatively new. IBM made this possible, and it’s a bit of a frontier. Once you become an intermediate Swift developer, this door opens up to you if you don’t really want to make iOS apps but instead, want to create web applications using Swift.
The way I found myself getting into Server-side Swift was through O’Reilly’s Extending Value(s) to the Server mini-book which is available for free as a PDF.
If that book is too technical for you, there is also Udacity’s Server-side Swift course that goes fairly in depth.
Now that learning resources are out of the way, it’s time to open your mind a bit about how to look at programming as a whole. This will help ease the fear and overwhelming anxiety you might face when you realize there’s actually so much you don’t know and there’s no one to hold your hand. Note: I’m leaving out new concepts like Optionals because those can be understood through books.
1. Object-Oriented Programming
The best way to represent this in words is a snake that eats its own tail. Object-Oriented programming languages exhibit this strange meta quality. Once you start making classes and structs, you also come to understand that the very primitive data types and frameworks you use are also classes and structs. One of two things generally happen, you either get confused or you have a revelation that everything isn’t as complicated as you might think.
The syntax is ugly, so let’s not get hung up on that. Once you have the “aha” moment about how objects are ubiquitous, then you have reached a magical point in your journey. Frameworks stop being so mystical, the documentation becomes less strange to look at, etc. In a way, understanding this will free you from being shy to explore the things you don’t know. It will allow you to search for answers to things you can’t put into words clearly.
2. Return Values
As an iOS developer, the best way to make things work is by using Swift Playgrounds. Swift Playgrounds is an interactive environment which you can open up as a standalone application or even inside your own application (I prefer this). The benefit of writing in Swift Playgrounds is that you can see your return values immediately and print to console without having to run your app a million times. Essentially, you are writing a proof of concept.
The key takeaway is that return values mean everything to you as a programmer. Writing small chunks of code and getting to see the results saves a lot of time before plugging it into your application.
There is a mantra, “make it work, then refactor”.
You will write code to achieve the return value needed for your application to work, and it will be smelly (code-smell) at first. Once your code works, then you can assess whether it’s as clean is it could be. As you get more comfortable with Swift, refactoring becomes something like a ritual.
4. Functional and Protocol-Oriented Programming
By the time you are done learning Swift through books, you will have at least heard of Protocols. If you are an exceptionally perceptive new programmer, you will quickly realize that Object-Oriented programming can get hairy sometimes when dealing with inheritance. Over the years there have been other approaches to modeling the world. The two worth mentioning are Functional and Protocol-Oriented programming. I just want to point these out to you so that you are aware and when you are ready you can consult these two resources to learn more.
If you’ve never thought about how data is persisted (stored for later use), then the time is now. There are a couple different types of ways databases can exist, such as SQL and NoSQL. Which is better is the subject of great debate but it’s best to get acquainted with both. In iOS development, your first experience with persistence will most likely involve using the Core Data framework with SQLite which is a relational database.
Programming after a certain point becomes an architectural conundrum, and that’s usually where the value of working with a team of developers comes in. You get to see how programmers before you have approached various issues. You’ll begin to learn about design patterns, clean architecture, object-oriented design (OOD), etc. So I’m going to leave you with some links to visit when you are ready.
1. Clean Swift – This blog is where Swift developers go to reach Nirvana. Extremely valuable resource for intermediate and advanced programmers.
2. OOD Principles In Swift – One day you will hear about Single-Responsibility Principle, there are more principles but this GitHub page is a fantastic resource to see those principles in action.
3. Design Patterns on iOS using Swift – Another great Ray Wenderlich tutorial, it’s a two-part series that shows various design patterns in Swift. A curious mind could definitely benefit from these eventually.
4. Parse Platform – Eventually, you are going to get tired of running application demos and will want to see your masterpiece come to life for others to enjoy. Enter the sacred realm of servers. There are a few options but none as mature and widely respected as Parse. Parse was once a great start-up acquired by Facebook and then turned open-source. That’s a beautiful thing. With Parse Server, you have control, who doesn’t want that?
Okay someone just said “but what about Firebase?”, calm down. Firebase is a fine choice if you don’t want to worry about self-hosting. But lets not make this complicated. If you want to compare the two, here’s a handy graphic.
Wrapping This Bad Boy Up
This is supposed to be the Ultimate Guide, the one resource you can always count on to guide through your mystical journey towards programmer happiness. It is a continuous work in progress and will be updated when need be. I hope that this resource is helpful for those interested in learning Swift and iOS Development.