質問編集履歴
1
不足していたソースコードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -59,6 +59,34 @@
|
|
59
59
|
.sheet(isPresented: $is_show_photo_library, content: {
|
60
60
|
ImagePicker(sourceType: .photoLibrary, selectedImage: self.$profile_image)
|
61
61
|
})
|
62
|
+
if (self.name.isEmpty){
|
63
|
+
Button(action: {
|
64
|
+
|
65
|
+
}) {
|
66
|
+
Text("confirm")
|
67
|
+
.font(.title2)
|
68
|
+
.padding(16)
|
69
|
+
.foregroundColor(Color.white)
|
70
|
+
.cornerRadius(10)
|
71
|
+
}.disabled(self.name.isEmpty)
|
72
|
+
} else {
|
73
|
+
Button(action: {
|
74
|
+
bindName = name
|
75
|
+
bindType = "\(food_style)"
|
76
|
+
bindImage = profile_image.pngData()
|
77
|
+
UserDefaults.standard.set(self.bindName, forKey: "launchedName")
|
78
|
+
UserDefaults.standard.set(self.bindImage, forKey: "launchedImage")
|
79
|
+
self.onSwitch.toggle()
|
80
|
+
self.presentationMode.wrappedValue.dismiss()
|
81
|
+
}) {
|
82
|
+
Text("confirm")
|
83
|
+
.font(.title2)
|
84
|
+
.padding(16)
|
85
|
+
.background(Color(red: 82/225, green: 194/225, blue: 125/225))
|
86
|
+
.foregroundColor(Color.white)
|
87
|
+
.cornerRadius(10)
|
88
|
+
}
|
89
|
+
}
|
62
90
|
}.navigationTitle("Settings")
|
63
91
|
}
|
64
92
|
}
|