Swift

Building the log in interface

To be able to log in, you will need to add three elements to the screen:

  • A Button to log in Alice
  • A Button to log in Bob

Open ContentView.swift and add it programmatically:

import SwiftUI

struct ContentView: View {

    var body: some View {
        NavigationStack {
            VStack {
                Button("Login as Alice") {
                    Task {
                        
                    }
                }.buttonStyle(.bordered)
                Button("Login as Bob") {
                    Task {
                        
                    }
                }.buttonStyle(.bordered)
            }
            .padding()
        }
    }
}

Build and Run

Run the project again (Cmd + R) to launch it in the simulator.

Interface