I am attempting to create a Settings module utilizing SwiftUI.
I’ve the next hierarchy
- Settings (struct)
- Part (struct)
- Subsection (struct)
- ButtonRow: Row
- Subsection (struct)
- ButtonRow: Row
- ToggleRow: Row
- Subsection (struct)
- Part (struct)
- Subsection (struct)
- ButtonRow: Row
- Subsection (struct)
- Part (struct)
The Row protocol is carried out as follows:
public protocol Row: Identifiable {
var id: UUID { get }
associatedtype Physique = View
var physique: Physique { get }
}
Every Row implementation must implement its personal View that might be rendered in Settings
struct ButtonRow: Row {
public var id: UUID = UUID()
public var title: String
init(_ title: String) {
self.title = title
}
public var physique: some View {
Textual content("Teste")
}
}
Nonetheless, I’m having the next error within the part highlighted within the code beneath:
enter picture description right here
Does anybody know the way I can resolve this?
I attempted utilizing AnyView(row.physique) however I feel it’s not the most effective answer when it comes to app efficiency and after I add a Toggle it’s not animated.