Swift

ログイン・インターフェースの構築

ログインできるようにするには、画面に3つの要素を追加する必要がある:

  • A Button アリスにログイン
  • A Button にログインする。

オープン ContentView.swift をプログラムで追加する:

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()
        }
    }
}

ビルド&ラン

プロジェクトを再度実行する (Cmd + R)を使ってシミュレーターで起動します。

Interface