Skip to content

Commit

Permalink
fixed broken editing
Browse files Browse the repository at this point in the history
Signed-off-by: Joseph Mattiello <[email protected]>
  • Loading branch information
JoeMatt committed Dec 11, 2024
1 parent 30617b1 commit 927eb57
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions PVUI/Sources/PVSwiftUI/GameMoreInfoUI/GameMoreInfoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -330,17 +330,21 @@ struct GameMoreInfoView: View {
}
.padding(.bottom, 50)
}
.alert(item: $editingField) { field in
Alert(
title: Text("Edit \(field.title)"),
message: nil,
primaryButton: .default(Text("Save")) {
.alert(editingField?.title ?? "", isPresented: .init(
get: { editingField != nil },
set: { if !$0 { editingField = nil } }
)) {
TextField("Value", text: $editingValue)
Button("Cancel", role: .cancel) {
editingField = nil
}
Button("Save") {
if let field = editingField {
saveEdit(field)
},
secondaryButton: .cancel {
editingField = nil
}
)
}
} message: {
Text("Enter a new value")
}
}

Expand Down

0 comments on commit 927eb57

Please sign in to comment.