Creating a Mind-Map UI in SwiftUI | raywenderlich.com

No worries

  1. Create a new file in the project called Helpers.swift. Copy/Paste that code into the file.

  2. Open SurfaceView.swift

  3. Examine the body property of struct SurfaceView. You’ll see that the top level item is a VStack.

  4. Delete the 3 Informational text fields. They don’t need to be there anymore.

  5. Instantiate Helpers , injecting the mesh and the selection. Your body should now start like this.

     var body: some View {
         VStack {
           // 1
           Helpers(mesh: mesh, selection: selection)
           TextField("Breathe…", text:
           .....
    

Screenshot 2020-03-31 at 13.53.54

My version has a white background because I’m painting the backing rect with Rectangle().fill(Color(UIColor.systemBackground))