23 lines
596 B
Swift
Executable File
23 lines
596 B
Swift
Executable File
import SwiftUI
|
|
|
|
struct PathField: View {
|
|
let title: String
|
|
@Binding var path: String
|
|
var canBrowse: Bool = true
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading, spacing: 6) {
|
|
Text(title).font(.headline)
|
|
HStack {
|
|
TextField(title, text: $path)
|
|
.textFieldStyle(.roundedBorder)
|
|
if canBrowse {
|
|
Button("Choose…") {
|
|
if let selected = FilePicker.chooseDirectory() { path = selected }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|