Files
audioserver/GrooveAudio (iOS)/UI/SettingsView.swift
T

30 lines
973 B
Swift

import SwiftUI
struct SettingsView: View {
@Environment(\.presentationMode) var presentationMode
@State private var host: String = AppSettings.shared.host
@State private var password: String = AppSettings.shared.password
var body: some View {
Form {
Section(header: Text("Server")) {
TextField("Host", text: $host)
.autocapitalization(.none)
.keyboardType(.URL)
SecureField("Password", text: $password)
}
Section {
Button("Connect") {
AppSettings.shared.host = host
AppSettings.shared.password = password
StreamPlayer.shared.reconnect(host: host, password: password)
presentationMode.wrappedValue.dismiss()
}
}
}
.navigationTitle("Settings")
.navigationBarTitleDisplayMode(.inline)
}
}