Why Swift iOS is Great as the First Programming Language to Learn

Blog post cover image.

When you google "first programming language to learn", the most common answer you can find is Python.

In this article, I will explain why learning iOS development in Swift is great for the first programming language to learn.

I started my journey in iOS development in May 2020 and I am on my final steps to publish my first app in the Appstore. Since I have experience in both Python and Swift I can argue that the latter is much more fun and exciting. Especially as an introduction to programming.

## What is Swift?

[Swift](https://developer.apple.com/swift/) is an open-source programming language used for creating iOS, macOS, and watchOS apps. It is advertised as safe, fast, and expressive. Most importantly, Apple and the developers consistently trying to make it as widely accessible and beginner-friendly as possible.

> "Swift can open doors to the world of coding. In fact, it was designed to be anyone’s first programming language, whether you’re still in school or exploring new career paths.", Apple

## Swift vs Python

My first programming language was indeed Python. I have been learning it for several years but didn't have any breakthrough progress. I know how it works, what I can do with it, but I did not end up creating something meaningful.

I used Python in many ways, including scripting in a 3d application, writing Jupyter notebooks to make an image classifier, and automating web scraping. Nonetheless, these tasks did not drive my learning process to advance in Python.

I lacked a form. Python is a scripting language, and you can do a lot with it. It is one of the main languages for Data Science and Machine Learning. You can automate stuff, write a deep learning model, and even create standalone software. However, it did not really work for me.

```python

## Python

print("Hello, World!)

def multiply(a, b):

    return a * b
```

```swift

// Swift

print("Hello, World!)

// In Swift you have to specify the variable type

// and whether the function returns anything

func multiply(a: Int, b: Int) -> Int {

    return a * b

}
```

Being a visual type of person, I found it hard to understand how code works when I did not have something visual to follow. Swift, on the other hand, is mainly used for creating apps. Most of the tutorials are focused on creating apps. Learning Swift will almost certainly result in building one.

> iOS development is encouraging because you work on real-world applications and receive a personal reward by publishing your app for people to use.

Working on an app was one of the crucial things in the learning process. Once I was halfway through my first course, I came up with an idea and jumped straight to developing it.

Habit tracking app main screen
The first app I am working on to publish in Appstore. It's a habit tracker backed by habit building theory.

Several months later, I am a few steps away to publish my first ever app in the Appstore. While working on it, I learned how to code interfaces with SwiftUI, how to use servers to store and retrieve information, how to log in and sign up users, and so on. Learning through creating an app proved much more encouraging and fun.

## 8 reasons to start your programming journey with iOS development in Swift

My learning path was practical and useful. XCode, the software you use to create an iOS or macOS app, is super helpful to see what your code does and what it does not in real-time.

Swift has the benefits of Python. It is beautiful, readable, and easy to grasp for beginners. It is fast and interactive.

Two years ago, Apple introduced SwiftUI, a declarative framework that made coding apps a lot easier. It is an excellent time to dive into it.

Here are 8 reasons why development in Swift iOS is an excellent choice to start your programming journey.

1. Clear and elegant syntax. Although it is a descendant of C, it is as elegant as Python.
2. Fast and interactive. In Swift Playground you can code and test the syntax quickly.
3. Visual. You can see what you code. The interface updates in real-time to reflect the changes in the code.
4. Relevant. App development is booming. If you want to start a career or change your profession, it can be a great option.
5. Fun. You create a product that can be used by thousands of people and potentially become a startup. And even bring a passive income.
6. Swift is easy to learn. The learning curve is shallow. Each app can be a project where you apply your knowledge. It is one of the most efficient ways to learn.
7. The introduction of SwiftUI in 2019 made iOS development even simpler. The latest Swift framework divides the app structure in a clear way that is very easy to grasp.
8. Swift is a language based on C. There are many similarities and the experience will help to learn and become fluent in other languages as well.

In the next chapter, I share a strategy that made my learning path easy and productive.

Habit tracking app progress screen
The progress screen. With SwiftUI prototyping interfaces is fun.

## How to start and learn Swift iOS programming. Step by step guide.

### Step 1. Learn fundamentals.

The first step I would recommend is reading articles for beginners and watching tutorials on YT to understand the fundamentals. Stanford, earlier in 2020, released their free CS193p Swift iOS course. It is up to date and great for understanding the fundamentals.

Resources to start with.

- [Stanford CS193p](https://cs193p.sites.stanford.edu/) - Developing Apps for iOS
- [Great video series](https://www.youtube.com/channel/UCOWdR4sFkmolWkU2fg669Gg) by Stuart Lynch on YouTube
- [BeyondOnesAndZeros](https://www.youtube.com/channel/UCop-9gn7T4vYACtRwpBlHZw) - another excellent channel
- [Hacking with Swift](https://www.hackingwithswift.com/) - one of the most popular resources by Paul Hudson
- [Swift Official Documentation](https://swift.org/documentation/#the-swift-programming-language) - well organized official documentation

### Step 2. Start developing your first app.

Completing the Stanford course will be enough to start with your first app. Following a course is helpful, but making your own one is a much better way of learning.

> Listening is at the bottom of the learning pyramid with only a 5% retention rate. Focus on active learning.

When I completed 70% of my first course and started building an app from scratch, I realized how little I retained from the lectures and coding along.

Learning pyramid and retention rates
Learning pyramid and retention rates.

Keep your first project simple. Complexity would only discourage you from solving the problems you face. Use the Goldilocks Principle instead. Build a simple app to learn fundamentals and keep you motivated. Increment the complexity, and advance your knowledge.

### Step 3. Take another, more advanced course.

Once you complete your first app, even if it is not published, you will get a sense of what you want to build next. The following course will cover the topics you want to learn more about.

For instance, I knew that I want to learn more about the Combine framework and Firestore as I wanted to implement them in my project. Therefore, I was more focused on the courses that cover SwiftUI, Combine, and Firestore.

If you are still not sure at this point and want to advance overall, I would recommend finding a course or a book that covers SwiftUI, MVVM framework, and data management. As you will see later, coding an interface (View) is the easiest part. Making a data model (Model) for your app is the second hardest. And creating a logic (ViewModel) that connects the interface and the data is the most challenging.

Pomodoro technique in habit tracker app
Pomodoro app.

### Step 4. Let the world see your work.

Finally, launch your app in the AppStore. Do not try to make it perfect. It will never be. Focus on core functionality. Releasing it sooner will give you the feedback and the knowledge on what to improve.

Publishing an app means you opened a developer account with Apple, learned to implement login and in-app purchases, and understood how to comply with Apple's app guidelines. Invaluable experience.

I am in the process of publishing my first app. There are a few core parts to complete before I finish. It is essential to experience the full journey from the start till the end and to see how it works in real life.

Try to implement the minimum viable product model and launch it as soon as possible. Feedback and the feeling of accomplishment will fuel you to progress further.

## Final thoughts

It is an exciting time to learn coding in Swift. Apple made it very easy for beginners. If you are more of a visual type of person and would like to create something cool, then Swift is a better choice for the first programming language to learn.

Join me on discord

I created a discord server where we can discuss productivity, Notion, books, and ideas. Join me and my Kajiwoto Pet. Also, if you want to help me to develop the server, please drop me a message.