NEW: My new book Pro SwiftUI is out now – level up your SwiftUI skills today! >>

What’s the difference between Swift and SwiftUI?

Paul Hudson    @twostraws   

Updated for Xcode 14.2

When you’re just learning Swift and SwiftUI the first time, you might look at Swift and SwiftUI and imagine that they are two competing choices for you to pick from. So, it’s perfectly understandable to ask what’s the difference between Swift and SwiftUI, and which should you choose?

Well, the reality is a little confusing, at least at first: you need them both. Swift is a programming language, which mean it’s the words we type into our computer to say what our program should do. Swift can be used in many places, but it’s mostly used for building apps on Apple’s platforms – iOS, macOS, watchOS, and tvOS.

On the other hand, SwiftUI is a set of tools that let us describe and control user interfaces. It knows what a button is and how it can be tapped by the user. It knows how to let users enter text. It knows how to show images, select dates, respond to swipe gestures, and much more.

Building an app is the process of writing Swift code to control SwiftUI. Swift is the language saying “I want a button here, and a text field here, and an image over there,” and SwiftUI is the part that actually knows how to make the button, how to draw the text, and how to load and show the image.

Almost all of this book focuses on Swift, with SwiftUI only getting small mentions here and there. This is because the goal of the book is to help you understand how the pure Swift language works, so you can use it with SwiftUI or indeed with any of Apple’s other user interface choices.

Hacking with Swift is sponsored by Essential Developer

SPONSORED From March 20th to 26th, you can join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer!

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Buy Pro Swift Buy Pro SwiftUI Buy Swift Design Patterns Buy Testing Swift Buy Hacking with iOS Buy Swift Coding Challenges Buy Swift on Sundays Volume One Buy Server-Side Swift Buy Advanced iOS Volume One Buy Advanced iOS Volume Two Buy Advanced iOS Volume Three Buy Hacking with watchOS Buy Hacking with tvOS Buy Hacking with macOS Buy Dive Into SpriteKit Buy Swift in Sixty Seconds Buy Objective-C for Swift Developers Buy Beyond Code

Was this page useful? Let us know!

Average rating: 4.4/5

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.