I have a view that is getting large and I want to factor out a chunk of it. One option is to extract a subview by creating a new struct that inherits from View and defines the body property. Another option is to create a function with a return type of some View. It's a bit less code that way. But I get the impression that creating a new View is preferred. What advantages does that have?
struct DemoView: View {
var body: some View {
Text("Demo")
}
}
vs.
func demoView() -> some View {
Text("Demo")
}