From the course: iOS Development Tips

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Checkboxes in SwiftUI

Checkboxes in SwiftUI

- [Instructor] There's lots of good stuff in SwiftUI. One missing control is old fashioned checkboxes like I have on the web or on my Mac. If you run SwiftUI code on a Mac, you'll get a checkbox if you use toggle, but not on my iPad or iPhone. It's not hard to put together though. As a bit of the intro into the philosophy of SwiftUI, let's look at hacking together a checkbox. Open up the project that I have in the exercise files. I made a second struct CheckView in the CheckView.Swift file and we'll use that for the checkbox. For this project, I find the canvas a little annoying to work around, so I'll have it closed here and I'll use a simulator instead. My checkbox will need a box. Now, I can use an image object in SwiftUI with the system name parameter to get an SF Symbol for SwiftUI. So I'm going to go here, and I'm going to just change my text to Image(systemName: "square"). Now, if I wanted a check square, I…

Contents