質問編集履歴

2

書式の改善

2022/09/05 16:23

投稿

runrun
runrun

スコア36

test CHANGED
File without changes
test CHANGED
@@ -23,13 +23,13 @@
23
23
 
24
24
  struct FirstView: View {
25
25
 
26
- @AppStorage("IntegerKey") var day = ""
26
+   @AppStorage("IntegerKey") var day = ""
27
- @AppStorage("launchedName") var bindName = "Name"
27
+   @AppStorage("launchedName") var bindName = "Name"
28
- @AppStorage("launchedImage") var bindImage: Data?
28
+   @AppStorage("launchedImage") var bindImage: Data?
29
29
 
30
- var body: some View {
30
+   var body: some View {
31
- NavigationView{
31
+   NavigationView{
32
- if let uiimage = UIImage(data: bindImage!) { //Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value
32
+    if let uiimage = UIImage(data: bindImage!) { //Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value
33
33
  Image(uiImage: uiimage)
34
34
  } else {
35
35
  Image("")
@@ -49,13 +49,13 @@
49
49
  import SwiftUI
50
50
 
51
51
  struct SettingView: View {
52
- @State private var name:String = ""
52
+   @State private var name:String = ""
53
- @State var onSwitch = false
53
+   @State var onSwitch = false
54
- @Binding var bindName: String
54
+   @Binding var bindName: String
55
- @Binding var bindImage: Data?
55
+   @Binding var bindImage: Data?
56
56
 
57
- var body: some View {
57
+   var body: some View {
58
-   if (self.name.isEmpty){
58
+    if (self.name.isEmpty){
59
59
  Button(action: {
60
60
 
61
61
  }) {
@@ -75,11 +75,10 @@
75
75
  self.presentationMode.wrappedValue.dismiss()
76
76
  }) {
77
77
  Text("confirm")
78
- .font(.title2)
79
- .padding(16)
80
- .foregroundColor(Color.white)
81
- .cornerRadius(10)
82
78
  }
79
+   }
80
+  }
81
+ }
83
82
  ```
84
83
 
85
84
  ### 補足情報(FW/ツールのバージョンなど)

1

書式の改善

2022/09/05 16:19

投稿

runrun
runrun

スコア36

test CHANGED
@@ -1 +1 @@
1
- Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value
1
+ UIImageUserdefaultに保存したい
test CHANGED
File without changes