DEV Community

Cover image for Swift 101: What's Swift?
Silvia España Gil
Silvia España Gil

Posted on • Originally published at dev.to

Swift 101: What's Swift?

Hola Mundo!

Ready for some Swift?

This is my first article in a series of Swift 101 notes 📝 I did while learning the language and I decided to share them because why not?.

Well and also because I received so many nice and encouraging comments on my Twitter account that made me super happy 💖.

When I first started mobile development and read about Swift I was quite confused because the only Swift I knew was the bank code 🙈​!

So, let's get to it.


What is Swift?

Swift is an open-source programming language specifically designed by Apple Inc. for development across the entire Apple ecosystem. While it's primarily associated with iOS development for iPhones and iPads, Swift is also utilized for macOS, watchOS, visionOS, and tvOS applications.

So whether you're building a mobile app, a desktop application, or software for wearable devices or home entertainment systems, Swift provides a unified language and toolset.

On its creation, Apple wanted to move away from C and ended up with an original object-oriented language that, in their words, aims to be new, modern, faster, and easier, allowing developers to produce expressive code.

Screenshot showing how code was written with Objective C vs Swift. In Objective C we have NSString *message = @"Hello, World!"; NSLog(@"%@", message);, while in Swift it's simpler and declarative let message = "Hello, World!" print(message)

“was inspired by drawing ideas from Ruby, Python, C#, CLU, and far too many others to list”

Chris Lattner


What is SwiftUI?

On the other hand, we have SwiftUI. SwiftUI is a Swift framework that allows us to describe and control the user interface. So basically it helps us build, what the user sees.

However, SwiftUI is quite new, and you may encounter some challenges building some things that you could solve with UIKit. UiKit was the former framework used to design the interface but that has been updated to SwiftUI. However I heavily recommend you to try and find SwiftUI solutions, even if they look harder, I've found that doing so is a great exercise to learn

WWDC 2022 - Platform State of the Union Screenshot that shows the phrase "The best way to build an app is with Swift and SwiftUI"


Swift vs. SwiftUI

I know you could be thinking, aren't both the same thing? But no, they are not, Swift and SwiftUI are not the same but they are complementary ones for each other.

Swift is the programming language, the one that says our app what our program should do. SwiftUI is a Swift framework, interface-oriented that controls the aspect of our application.

"Building an app is the process of writing Swift code to control SwiftUI"

Paul Hudson


How to code with Swift? -

IDE

As with all languages, to code we need an IDE. An IDE is an Integrated Development Environment, in simpler words is a code editor in which developers can write and build code.

If you want to build iOS apps with Swift you will need XCode. This IDE is available in the App Mac Store and on the Developer's Resources page, here

XCode is only intended to run on Mac and it allows us to create full-on projects for mobile, wearables, and tv.
Screenshot of XCode Tab
If you don't have a Mac but still want to try some Swift you may download Swift Playgrounds on iPad or use an online tool like Online Swift Playground


Want to keep learning about Swift?

This a full series on Swift 101, next chapter will be about Types, variables, and constants in Swift, so I hope to see you there!

If you enjoyed this, please share, like, and comment. I hope this can be useful to someone and that it will inspire more people to learn and code with Swift

Top comments (0)