Menu
Coddy logo textTech

Choose A Size

Part of the Introduction to SwiftUI section of Coddy's Swift journey. Lesson 45 of 50.

challenge icon

Challenge

Easy

Keep everything from the previous steps. In OrderView, add a @State size that starts as "Medium", and below the price a segmented Picker titled Size with the options Small, Medium and Large, each tagged with its name. Give the picker the identifier size.

Try it yourself

import SwiftUI

@main
struct CoddyApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

All lessons in Introduction to SwiftUI

Practice on your own: Swift playground