Hello there! Recently I ran into an issue with the var body: some View part of the view, where it had so much code it couldn't type-check fast enough. I was told to divide it into multiple smaller bodies, but I cannot figure out how to do that. Let me share an example of some code:
If anyone knows how to fix this, I'd love to hear from you! Any help is appreciated!
Code Block swift struct ContentView: View { let exampleVariable = "Example" func exampleFunc { print("Example") } var body: some View { Text("Hello") } var secondBody: some View { Text("World") } } struct ContentView_Previews: PreviewProvider { static var previews: some View { Group { ContentView() .previewDisplayName("iPod Touch") } } } // I cannot figure out what to do to this last part that actually makes the view include the second body, "secondBody"
If anyone knows how to fix this, I'd love to hear from you! Any help is appreciated!