Improve page and post detail views
This commit is contained in:
@ -8,9 +8,12 @@ struct OptionalTextField: View {
|
||||
// The optional text that will be passed in and out of the component
|
||||
@Binding var text: String?
|
||||
|
||||
init(_ titleKey: LocalizedStringKey, text: Binding<String?>) {
|
||||
let prompt: String?
|
||||
|
||||
init(_ titleKey: LocalizedStringKey, text: Binding<String?>, prompt: String? = nil) {
|
||||
self.titleKey = titleKey
|
||||
self._text = text
|
||||
self.prompt = prompt
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
@ -23,6 +26,6 @@ struct OptionalTextField: View {
|
||||
// Convert an empty string to `nil`
|
||||
text = newValue.isEmpty ? nil : newValue
|
||||
}
|
||||
))
|
||||
), prompt: prompt.map(Text.init))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user