mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 23:03:27 +01:00
[ADD] Authentication view for connecting SideStore to an Apple ID
This commit is contained in:
52
AltStore/View Components/RoundedTextField.swift
Normal file
52
AltStore/View Components/RoundedTextField.swift
Normal file
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// RoundedTextField.swift
|
||||
// SideStore
|
||||
//
|
||||
// Created by Fabian Thies on 29.11.22.
|
||||
// Copyright © 2022 SideStore. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct RoundedTextField: View {
|
||||
|
||||
let title: String?
|
||||
let placeholder: String
|
||||
@Binding var text: String
|
||||
let isSecure: Bool
|
||||
|
||||
init(title: String?, placeholder: String, text: Binding<String>, isSecure: Bool = false) {
|
||||
self.title = title
|
||||
self.placeholder = placeholder
|
||||
self._text = text
|
||||
self.isSecure = isSecure
|
||||
}
|
||||
|
||||
init(_ placeholder: String, text: Binding<String>, isSecure: Bool = false) {
|
||||
self.init(title: nil, placeholder: placeholder, text: text, isSecure: isSecure)
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
if let title {
|
||||
Text(title.uppercased())
|
||||
.font(.system(size: 12))
|
||||
.foregroundColor(.secondary)
|
||||
.padding(.horizontal)
|
||||
}
|
||||
|
||||
HStack(alignment: .center) {
|
||||
if isSecure {
|
||||
SecureField(placeholder, text: $text)
|
||||
} else {
|
||||
TextField(placeholder, text: $text)
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 12)
|
||||
.foregroundColor(Color(.secondarySystemBackground))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user