File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -3,15 +3,13 @@ import Flow
3
3
4
4
struct EntryView : View {
5
5
let entry : Entry
6
- @State var tags : [ Tag ]
7
- @State var fields : [ Field ]
6
+ @State var tags : [ Tag ] = [ ]
7
+ @State var fields : [ Field ] = [ ]
8
8
@State var showTagSelector : Bool = false
9
9
@State var showFieldTypeSelector : Bool = false
10
10
11
11
init ( entry: Entry ) {
12
12
self . entry = entry
13
- self . tags = entry. getTags ( )
14
- self . fields = entry. getFields ( )
15
13
}
16
14
17
15
var body : some View {
@@ -214,6 +212,9 @@ struct EntryView: View {
214
212
}
215
213
. tint ( . red)
216
214
}
215
+ } . onAppear {
216
+ self . tags = entry. getTags ( )
217
+ self . fields = entry. getFields ( )
217
218
}
218
219
}
219
220
}
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import SwiftUI
3
3
struct TagManagerView : View {
4
4
@Environment ( \. dismiss) private var dismiss
5
5
let library : Library
6
+ @State var tags : [ Tag ] = [ ]
6
7
@State var showNewTag : Bool = false
7
8
8
9
init ( library: Library ) {
@@ -13,7 +14,7 @@ struct TagManagerView: View {
13
14
NavigationView {
14
15
ScrollView {
15
16
VStack {
16
- ForEach ( Tag . fetchAll ( library : library ) , id: \. id) { tag in
17
+ ForEach ( $tags , id: \. id) { $ tag in
17
18
NavigationLink ( destination: TagDetailsView ( tag: tag) ) {
18
19
TagView ( tag: tag, fullWidth: true )
19
20
}
@@ -56,6 +57,8 @@ struct TagManagerView: View {
56
57
}
57
58
}
58
59
}
60
+ } . onAppear {
61
+ self . tags = Tag . fetchAll ( library: library)
59
62
}
60
63
}
61
64
}
You can’t perform that action at this time.
0 commit comments