-
Notifications
You must be signed in to change notification settings - Fork 0
/
Profile.swift
54 lines (39 loc) · 1.13 KB
/
Profile.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//
// Profile.swift
// Industrial_APP
//
// Created by User on 2023/12/29.
//
import Foundation
import SwiftUI
struct UserProfile: Identifiable {
let id = UUID()
var firstName: String
var lastName: String
var email: String
var bio: String
}
class ProfileManager: ObservableObject {
@Published var userProfile: UserProfile
init(userProfile: UserProfile) {
self.userProfile = userProfile
}
}
struct rofileView: View {
@ObservedObject var profileManager: ProfileManager
var body: some View {
Form {
Section(header: Text("個人檔案")) {
TextField("名字", text: $profileManager.userProfile.firstName)
TextField("姓氏", text: $profileManager.userProfile.lastName)
TextField("Email", text: $profileManager.userProfile.email)
}
Section(header: Text("個人簡介")) {
TextEditor(text: $profileManager.userProfile.bio)
.frame(height: 100)
}
}
.navigationTitle("個人檔案")
.navigationBarTitleDisplayMode(.inline)
}
}