Was a workaround for iOS 15. No longer required. Signed-off-by: kingbri <bdashore3@proton.me>
36 lines
1,014 B
Swift
36 lines
1,014 B
Swift
//
|
|
// SourceSettingsBaseUrlView.swift
|
|
// Ferrite
|
|
//
|
|
// Created by Brian Dashore on 3/24/23.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct SourceSettingsBaseUrlView: View {
|
|
@ObservedObject var selectedSource: Source
|
|
|
|
@State private var tempSite: String = ""
|
|
var body: some View {
|
|
Section(
|
|
header: Text("Base URL"),
|
|
footer: Text("Enter the base URL of your server.")
|
|
) {
|
|
TextField("https://...", text: $tempSite, onEditingChanged: { isFocused in
|
|
if !isFocused {
|
|
if tempSite.last == "/" {
|
|
selectedSource.website = String(tempSite.dropLast())
|
|
} else {
|
|
selectedSource.website = tempSite
|
|
}
|
|
}
|
|
})
|
|
.keyboardType(.URL)
|
|
.autocorrectionDisabled(true)
|
|
.autocapitalization(.none)
|
|
.onAppear {
|
|
tempSite = selectedSource.website ?? ""
|
|
}
|
|
}
|
|
}
|
|
}
|