Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
Polish Password Checker Demo
Browse files Browse the repository at this point in the history
  • Loading branch information
david-swift committed Jul 4, 2024
1 parent 8014a6e commit c17730e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Tests/PasswordCheckerDemo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ struct PasswordCheckerDemo: View {
struct WindowContent: View {

@State private var password = ""
@State private var copied: Signal = .init()

var checkStatus: [String: Bool] {
PasswordChecker.allCases.enumerated().reduce([String: Bool]()) { dict, checker in
var dict = dict
Expand All @@ -86,14 +88,17 @@ struct PasswordCheckerDemo: View {
.suffix {
Button(icon: .default(icon: .editCopy)) {
State<Any>.copy(password)
copied.signal()
}
.flat()
.verticalCenter()
.tooltip("Copy")
Button(icon: .default(icon: .editClear)) {
password = ""
}
.flat()
.verticalCenter()
.tooltip("Clear")
}
}
}
Expand All @@ -108,6 +113,7 @@ struct PasswordCheckerDemo: View {
}
}
.padding()
.toast("Copied to clipboard", signal: copied)
.frame(minWidth: 340, minHeight: 400)
.topToolbar {
HeaderBar.empty()
Expand Down

0 comments on commit c17730e

Please sign in to comment.