Menu
Coddy logo textTech

Recap - Plant Guide

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

challenge icon

Challenge

Medium

Build a plant guide. ContentView shows a NavigationStack (identifier nav) with a List titled Plants, one NavigationLink per plant, titled with its name. Each link opens PlantDetail for its plant, which:

  • uses the plant's name as its title
  • shows Water every 7 days (from waterDays) in a text with the identifier water
  • has a Watered button that shows an alert titled Nice work! with an OK button

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