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