Notice: Undefined index: understanding-swift in /var/sites/hackingwithswift.com/site/src/Controller/NewBooksReadController.php on line 89
What’s the difference between Swift and SwiftUI? - a free tutorial

NEW: Subscribe to Hacking with Swift+ and accelerate your learning! >>

What’s the difference between Swift and SwiftUI?

Paul Hudson    @twostraws   

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 NSSpain

SPONSORED Announcing NSSpain 2020: Remote Edition! An online, continuous conference for iOS developers. We’ll start on Thursday and finish on Friday, with talks, activities, and lots of fun for 36 hours, non-stop. Sound good? Join us!

Find out more

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

BUY OUR BOOKS
Buy Pro Swift 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 (Vapor Edition) 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 Server-Side Swift (Kitura Edition) Buy Beyond Code

Was this page useful? Let us know!

Link copied to your pasteboard.