Chapter 10. Getting Started With Swiftui: User Interfaces…Swiftly

image

It’s time to use your toolbox full of Swift techniques, features, and components: you’re going to start building user interfaces. A Swift UI, if you will. We’re going to bring everything together in this chapter to create our first true user interface. We’ll build a whole experience using SwiftUI, the user interface framework for Apple’s platforms. We’ll still be using Playgrounds, at least initially, but everything we’re doing here will lay the groundwork for an actual iOS application. Get ready: this chapter is full of code and a lot of new concepts. Take a deep breath, and turn the page to dive into SwiftUI.

Note

Yes, it’s really named that. This isn’t another pun...at least, it’s Apple’s pun, not ours.

What’s a UI framework, anyway?

image

Frank: So, does anyone know what a UI framework is?

Judy: It’s a.. framework...for UI?

Jo: It’s a set of tools for drawing visual elements on the screen. In this case, it’s called SwiftUI, and it’s built using the fundamental bits and pieces of Swift we’ve all been learning.

Frank: So how’s it work?

Judy: Is it good?

Jo: You construct you UI programmatically, using structs and properties, and things like that.

Judy: How do you build a UI using structs?

Frank: I assume we’ll ...

Get Head First Swift now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.