Learn Swift Programming The Simple Way


Aasif Khan
By Aasif Khan | Last Updated on December 22nd, 2021 6:34 am | 4-min read

Swift is a powerful and easy to learn programming language for iOS, macOS, and more. Learning how to code Swift is simple, a lot of fun, and you can build awesome apps with it! In this tutorial, we’ll discuss simple approaches to learn Swift coding.

Here’s what we’ll get into:

  • How to get started with Swift programming – what do you need?
  • Learning techniques that best fit your style of learning
  • Beginner topics that are smart to master first
  • Resources that can help you: tutorials, courses, books, blogs
  • Helpful approaches for learning, like practicing an hour a day
  • Next level topics and concepts, if you’re up for the challenge

Getting Started with Swift

The Swift Programming Language was initially created by Apple, and released in 2014. The language is being actively developed, and the most recent version is Swift 5. You can code Swift for iOS, macOS, tvOS, iPadOS, watchOS, and even server-side Swift. In 2019, Apple launched an awesome new technology to build UIs called SwiftUI.

The most straightforward way to code Swift is with a Mac and Xcode. You’ll need a Mac computer to install Xcode, like a MacBook, or you can try to install macOS on PC. You can download and install Xcode on your Mac via the App Store. You can also download Xcode via developer.apple.com.

Another exciting way you can learn to code Swift is via the Swift Playgrounds app for iPad. It’s a gamified, playful and fun way to get started with Swift programming. And it’s not just for kids!

Now that you’ve got Xcode installed, building an entire app sure is a daunting challenge. Thankfully, Xcode has playgrounds too, that you can use to code Swift without needing to build an entire app. You can just try out some Swift code to get your bearings, or practice with a hands-on example (see below).

You can also use the Swift Programming Language to code server-side apps. These apps don’t live on an iPhone or iPad, but they live on a webserver somewhere, in the cloud. Server-side Swift is perfect for creating web apps, or app back-ends, or webservices that power other apps. The best way to get started with server-side Swift is via the Swift CLI for Linux, or through Vapor or Kitura.

Here’s a quick summary of what we’ve discussed so far:

  • Getting started with Swift is as easy as installing Xcode on your Mac
  • You can code Swift in an Xcode Playground, or via the Playgrounds iPad app
  • Interested in server-side Swift? Check out Vapor or Kitura!

Learn With Tutorials, Projects, Videos?

When you’re learning Swift, it’s important to find your ideal learning style.

Some people learn better with hands-on videos, and others have more success by reading a guide or tutorial. You might want a pro iOS developer on speed dial, for questions and support. What about a community of Swift learners? And some of us simply learn best by trial-and-error and building lots of Swift projects.

Let’s figure out a few learning styles, and resources that can help you learn Swift more effectively.

Learn Swift via a bootcamp

A bootcamp is a completely immersive classroom/workshop environment, where you learn Swift programming and iOS development from one or more tutors. Most bootcamps have high success rates, but they can also be expensive. Many bootcamps offer a job guarantee, or help you find work as a professional Swift developer.

A few popular bootcamps include Big Nerd Ranch, DevMountain and General Assembly.

It’s worth it to find a local bootcamp near you, so you can attend over a longer period of time. Some bootcamps and study groups are run by volunteers, and they rely on freely accessible learning materials, like those of freeCodeCamp.

Learning via videos and screencasts

Screencasts are a simple audiovisual way to convey what’s happening on screen, while teaching important Swift programming topics. It’s like being in a classroom with a teacher, while not being in a classroom with a teacher. Learning by video is effective, but there are disadvantages: poor video quality, needing to pause the video to code, the inability to copy and paste code on-screen, and outdated tutorials.

You can find plenty of Swift videos on YouTube, like Sean Allen, Lets Build That App and CodeWithChris. It’s worth it to find a teacher you like, because that helps you learn more easily.

Learn Swift from tutorials, books and blogs

Reading a book and following some exercises, is as straightforward as it is effective. Tutorials, articles and guides are a proven way to learn more about Swift programming. You can take a deep dive into a specific Swift topic, or follow a complete hands-on tutorial, to build a cool app project.

Learning by reading has lots of advantages, like keeping your own pace, making notes on the page, and mix-and-matching your own learning path. Books about Swift can be outdated when they’re released, but that shouldn’t be a problem. A downside of finding your own learning materials is that tutorials often lack structure, which means you could develop “gaps” in your knowledge.

The easiest way to find tutorials is to search on Google or DuckDuckGo, or to read from your most favorite authors, such as Swift By Sundell, AppCoda, Swift with Majid or Hacking With Swift. You can also find more beginner tutorials, below.

Learn Swift coding by doing

Learning Swift coding by building something, should be part of every Swift learner’s approach. You only learn so much from reading blogs and watching videos; you gotta do stuff at some point. What about putting into practice what you’ve learned?

A great approach to learn-by-doing is to keep track of principles, topics and techniques you’ve read about (or watched). You then commit to trying each of them in a Swift project yourself. You could, for example, read about closures and then practice working with them in an iOS app project.

Another smart technique is to learn by checking out sample projects. You can find plenty of example code on GitHub. It’s also a great idea to read the source code of open source libraries you’re using — you can learn a great deal from those. Another good resource to keep an eye on are Awesome lists, like this one about Swift.

Learning from (paid) courses

When you’re learning Swift, you can go it alone, or you can learn with a proven, high quality resource, such as a course on iOS development.

A good course has the added benefit of helping you organize your learning trajectory, so you don’t have to figure out what you’re going to learn next. Just follow the course, and if it’s well written, it’ll expose you to the different Swift and iOS topics you need to learn more about. And when the course helps you build real-world projects — even better!

Most courses are also actively kept up-to-date, which is important if you’re learning Swift. The Swift language changes often (about twice a year), so it’s smart to make sure you’re working with the latest materials.

Here’s a quick summary of what we’ve discussed so far:

  • You can choose from a few alternative learning methods, including videos, tutorials, bootcamps, courses, and more
  • It’s smart to figure out which approach suits your needs and wishes best
  • Whatever you do, build stuff yourself — don’t just watch tutorials!

Start with These Swift Topics

Don’t know where to start learning Swift programming? The following list of topics includes must-know principles, syntax and techniques. You can complete these topics in a few hours, and hit the ground running!

Beginner

  • Variables & Constants
  • Swift Functions
  • Optionals
  • Conditional Code & Logic
  • Arrays, Dictionaries and Sets
  • Classes and structs

Intermediate

  • For Loops
  • Object-Oriented Programming (OOP)
  • Initializers
  • Protocols
  • Scope & Context
  • Delegation
  • Structs vs. Classes
  • Value Types vs. Reference Types
  • Operators

Advanced

  • Closures
  • Generics
  • Opaque Types
  • Any & AnyObject
  • Error Handling
  • FlatMap & CompactMap

Cool tutorials about algorithms:

  • Palindromes
  • Binary Search
  • Roman Numerals
  • Insertion Sort
  • FizzBuzz
  • Shuffling Arrays
  • Conway’s Game of Life

Quick Tip: At which level of skill should you practice? First, revisit what you already know. Then, pick a topic that you haven’t mastered yet. Not too easy, not too hard. That way you stay inspired, don’t slack, but don’t get frustrated either. Wax on, wax off.

Practice Coding One Hour Every Day

So far, we’ve discussed Swift topics to learn, different resources you can use, learning styles, but what about learning technique? How do you actually learn all this stuff!? It’s the most important question of this tutorial, really.

The answer is simple: Practice coding Swift for 1 hour a day, for a year.

Differently said:

  1. Code.
  2. Code more.
  3. Code even more.
  4. Code even more than that.
  5. Code when you don’t want to.
  6. Code when you do.
  7. Code when you feel inspired.
  8. Code when you don’t.
  9. Code every day.
  10. Keep coding.

Inspired by 10 Steps to Becoming a Better Writer.

Getting good at Swift coding isn’t a matter of smarts or intelligence, but a matter of exposure: How many hours, effort and deliberate practice are you investing in exposing yourself to Swift code? Combined with the right resources and the right approach, you’ve got a recipe for success.

I’ve taught iOS development and Swift programming for a few years now, and I keep seeing beginner coders make the same mistake. They focus intensely on Swift coding for a day, and then forget about it for a week. When they get back at it, frustration creeps in, because most of their progress has been lost.

The most popular Coursera course, Learning How To Learn, talks about a technique called spaced repetition. It’s quite simple, really. You just get into the habit of exercising, and you find a balance between learning and relaxation. You learn on Mondays, Wednesdays and Fridays, and you give your mind rest in between. You space out the repetitions and exercises, so to speak. And the effectiveness of this technique is backed up by science!

So, learn for an hour every day, for a year. Exercise, exercise, exercise. Practice makes perfect – and permanent! You’ll miss a day or two, and that’s alright. Just pick it up again the next day. Before you know it, you’ve build a habit, and that’s powerful momentum towards reaching your goal: to successfully learn Swift programming.

Here’s a quick summary of what we’ve discussed so far:

  • Practice coding Swift for one hour a day, for a year
  • Use spaced repetition to increase comprehension and recall
  • Practice makes permanent – build a habit and make progress towards your goal

Don’t know where to start? Give any of the different topics on this page (listed above) a try!

Next Level Topics & Challenges

What’s next? Swift in and of itself is incredibly fun to learn, and to master, and to play with. But what can you do now that you’ve learned Swift? Let’s discuss a few possible next steps.

Build your own iOS apps:

  • Xcode Tutorial for Beginners (How To)
  • Create An iOS Game With Swift In Xcode
  • How I Went From App Idea To App
  • How To Make An App (In 9 Steps)

Become a professional iOS developer:

  • How To Beat The iOS Coding Interview
  • How To Get Freelance iOS Development Projects
  • How To Become A Senior iOS Developer
  • Recession Proof Developer – A How To

Have more fun with iOS development and Swift:

  • Getting Started With SwiftUI
  • How To Learn iOS App Development
  • Quit Coding? Here’s How To Start Building Apps Again
  • Getting Started With Debugging In Xcode

Further Reading

Awesome! In this tutorial, we’ve discussed how you can learn Swift. We’ve talked about learning techniques, topics you’ll need to master, and what learning style suits you best. There’s plenty of resources on this page to get started, so dig in!


Aasif Khan

Head of SEO at Appy Pie

App Builder

Leave a Reply

Your email address will not be published. Required fields are marked *

Most Popular Posts