Use PasteButton on iOS 16
This commit is contained in:
parent
5f5666c40d
commit
02e229042a
|
@ -41,15 +41,25 @@ struct EditKeyForm: View {
|
||||||
|
|
||||||
HStack {
|
HStack {
|
||||||
TextField("Secret", text: $editedKey.secret)
|
TextField("Secret", text: $editedKey.secret)
|
||||||
Button {
|
if #available(iOS 16.0, *) {
|
||||||
self.editedKey.secret = UIPasteboard.general.string ?? ""
|
PasteButton(payloadType: String.self) { pasted in
|
||||||
} label: {
|
if let s = pasted.first {
|
||||||
Label("Paste", systemImage: "doc.on.clipboard")
|
self.editedKey.secret = s
|
||||||
.labelStyle(.iconOnly)
|
}
|
||||||
.foregroundColor(.accentColor)
|
}
|
||||||
|
.labelStyle(.iconOnly)
|
||||||
|
.buttonBorderShape(.capsule)
|
||||||
|
} else {
|
||||||
|
Button {
|
||||||
|
self.editedKey.secret = UIPasteboard.general.string ?? ""
|
||||||
|
} label: {
|
||||||
|
Label("Paste", systemImage: "doc.on.clipboard")
|
||||||
|
.labelStyle(.iconOnly)
|
||||||
|
.foregroundColor(.accentColor)
|
||||||
|
}
|
||||||
|
.buttonStyle(.plain)
|
||||||
|
.disabled(!UIPasteboard.general.hasStrings)
|
||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
|
||||||
.disabled(!UIPasteboard.general.hasStrings)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HStack {
|
HStack {
|
||||||
|
|
Loading…
Reference in New Issue