Format
This commit is contained in:
1 file changed
+10
-7
@@ -38,10 +38,10 @@ struct ContentView: View {
|
|||||||
|
|
||||||
func generatePassword() {
|
func generatePassword() {
|
||||||
let chars =
|
let chars =
|
||||||
(useUppercase ? charsUpper : "") +
|
(useUppercase ? charsUpper : "") +
|
||||||
(useLowercase ? charsLower : "") +
|
(useLowercase ? charsLower : "") +
|
||||||
(useNumbers ? charsNumber : "") +
|
(useNumbers ? charsNumber : "") +
|
||||||
(useSymbols ? charsSymbols : "")
|
(useSymbols ? charsSymbols : "")
|
||||||
|
|
||||||
if chars.isEmpty {
|
if chars.isEmpty {
|
||||||
password = ""
|
password = ""
|
||||||
@@ -62,14 +62,16 @@ struct ContentView: View {
|
|||||||
.fontWeight(.bold)
|
.fontWeight(.bold)
|
||||||
Text("Select a length, or use the slider for a custom value")
|
Text("Select a length, or use the slider for a custom value")
|
||||||
|
|
||||||
Text("Password Length: " + String(length)).padding(.top)
|
Text("Password Length: " + String(length))
|
||||||
|
.padding(.top)
|
||||||
Slider(
|
Slider(
|
||||||
value: Binding(
|
value: Binding(
|
||||||
get: { Double(length) },
|
get: { Double(length) },
|
||||||
set: { length = Int($0) }
|
set: { length = Int($0) }
|
||||||
),
|
),
|
||||||
in: 1...500
|
in: 1...500
|
||||||
).onChange(of: length) { generatePassword() }
|
)
|
||||||
|
.onChange(of: length) { generatePassword() }
|
||||||
|
|
||||||
HStack {
|
HStack {
|
||||||
Button("8") {
|
Button("8") {
|
||||||
@@ -94,7 +96,8 @@ struct ContentView: View {
|
|||||||
.buttonStyle(.bordered)
|
.buttonStyle(.bordered)
|
||||||
}
|
}
|
||||||
|
|
||||||
Text("Characters to use").padding()
|
Text("Characters to use")
|
||||||
|
.padding()
|
||||||
LazyVGrid(
|
LazyVGrid(
|
||||||
columns: [
|
columns: [
|
||||||
GridItem(.adaptive(minimum: 180))
|
GridItem(.adaptive(minimum: 180))
|
||||||
|
|||||||
Reference in new issue
Block a user