forked from aparoksha/adwaita-swift
Polish Password Checker Demo
This commit is contained in:
parent
8014a6ea4d
commit
c17730e89d
@ -70,6 +70,8 @@ struct PasswordCheckerDemo: View {
|
|||||||
struct WindowContent: View {
|
struct WindowContent: View {
|
||||||
|
|
||||||
@State private var password = ""
|
@State private var password = ""
|
||||||
|
@State private var copied: Signal = .init()
|
||||||
|
|
||||||
var checkStatus: [String: Bool] {
|
var checkStatus: [String: Bool] {
|
||||||
PasswordChecker.allCases.enumerated().reduce([String: Bool]()) { dict, checker in
|
PasswordChecker.allCases.enumerated().reduce([String: Bool]()) { dict, checker in
|
||||||
var dict = dict
|
var dict = dict
|
||||||
@ -86,14 +88,17 @@ struct PasswordCheckerDemo: View {
|
|||||||
.suffix {
|
.suffix {
|
||||||
Button(icon: .default(icon: .editCopy)) {
|
Button(icon: .default(icon: .editCopy)) {
|
||||||
State<Any>.copy(password)
|
State<Any>.copy(password)
|
||||||
|
copied.signal()
|
||||||
}
|
}
|
||||||
.flat()
|
.flat()
|
||||||
.verticalCenter()
|
.verticalCenter()
|
||||||
|
.tooltip("Copy")
|
||||||
Button(icon: .default(icon: .editClear)) {
|
Button(icon: .default(icon: .editClear)) {
|
||||||
password = ""
|
password = ""
|
||||||
}
|
}
|
||||||
.flat()
|
.flat()
|
||||||
.verticalCenter()
|
.verticalCenter()
|
||||||
|
.tooltip("Clear")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -108,6 +113,7 @@ struct PasswordCheckerDemo: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding()
|
.padding()
|
||||||
|
.toast("Copied to clipboard", signal: copied)
|
||||||
.frame(minWidth: 340, minHeight: 400)
|
.frame(minWidth: 340, minHeight: 400)
|
||||||
.topToolbar {
|
.topToolbar {
|
||||||
HeaderBar.empty()
|
HeaderBar.empty()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user