[CHANGE] UI fixes and SwiftUI previews for easier development

This commit is contained in:
Fabian Thies
2023-02-19 14:30:21 +01:00
parent bc2cae46a8
commit ffe8a92a4e
12 changed files with 171 additions and 62 deletions

View File

@@ -14,6 +14,16 @@ struct ModalNavigationLink<Label: View, Modal: View>: View {
@State var isPresentingModal: Bool = false
init(@ViewBuilder modal: @escaping () -> Modal, @ViewBuilder label: @escaping () -> Label) {
self.modal = modal
self.label = label
}
init(_ title: String, @ViewBuilder modal: @escaping () -> Modal) where Label == Text {
self.modal = modal
self.label = { Text(title) }
}
var body: some View {
SwiftUI.Button {
self.isPresentingModal = true
@@ -26,8 +36,10 @@ struct ModalNavigationLink<Label: View, Modal: View>: View {
}
}
//struct ModalNavigationLink_Previews: PreviewProvider {
// static var previews: some View {
// ModalNavigationLink()
// }
//}
struct ModalNavigationLink_Previews: PreviewProvider {
static var previews: some View {
ModalNavigationLink("Present Modal") {
Text("Modal")
}
}
}