This repository was archived by the owner on Oct 6, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,13 @@ extension AccountView {
58
58
}
59
59
AccountDetailsView ( account: account, isEditing: $isEditing)
60
60
. padding ( . vertical)
61
+ GroupBox {
62
+ TextField ( " Notes " , text: $newNotes, onCommit: {
63
+ account. notes = newNotes
64
+
65
+ try ? viewContext. save ( )
66
+ } ) . textFieldStyle ( . plain)
67
+ }
61
68
#if os(macOS)
62
69
Spacer ( )
63
70
#endif
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import SwiftUI
9
9
10
10
struct AccountView : View {
11
11
// MARK: - Environment
12
- @Environment ( \. managedObjectContext) private var viewContext
12
+ @Environment ( \. managedObjectContext) var viewContext
13
13
14
14
// MARK: - CoreData
15
15
@FetchRequest (
@@ -20,6 +20,8 @@ struct AccountView: View {
20
20
// MARK: - Variables
21
21
let account : Account
22
22
@State var isEditing : Bool = false
23
+ @State var newNotes : String = " "
24
+
23
25
@State private var isAddingAlternateDomains : Bool = false
24
26
@State private var newAlternateDomains : String = " "
25
27
@State private var isSharing : Bool = false
@@ -30,6 +32,8 @@ struct AccountView: View {
30
32
31
33
let predicate = NSPredicate ( format: " domain contains[c] %@ " , account. domain!)
32
34
self . _accounts = FetchRequest ( sortDescriptors: [ ] , predicate: predicate, animation: . default)
35
+
36
+ self . _newNotes = . init( initialValue: account. notes ?? " " )
33
37
}
34
38
35
39
// MARK: - View
You can’t perform that action at this time.
0 commit comments