Windowgroup

has anyone gotten their 3d Models to render in seperate windows, i tried following the code in the video for creating a seperate window group, but i get a ton of obsecure errors, i was able to get it to render in my 2d windows, but when i try making a seperate window group i get errors

Accepted Reply

for anyone that runs into the same issue, i figured it out, the model3D needs to be in its own view, and you put that inside the windowgroup, instead of the model3D.

e.g:

import SwiftUI



@main

struct _5puzzleApp: App {

    var body: some Scene {

        WindowGroup {

            ContentView()

        }

        

        WindowGroup(id: "planet-earth") {

            EarthView()

        }

        .windowStyle(.volumetric)

            .defaultSize(width: 0.8, height: 0.8, depth: 0.8, in: .meters)

    }

}



struct EarthView: View {

    var body: some View {

        Model3D(named: "Earth")

    }

}

Replies

for anyone that runs into the same issue, i figured it out, the model3D needs to be in its own view, and you put that inside the windowgroup, instead of the model3D.

e.g:

import SwiftUI



@main

struct _5puzzleApp: App {

    var body: some Scene {

        WindowGroup {

            ContentView()

        }

        

        WindowGroup(id: "planet-earth") {

            EarthView()

        }

        .windowStyle(.volumetric)

            .defaultSize(width: 0.8, height: 0.8, depth: 0.8, in: .meters)

    }

}



struct EarthView: View {

    var body: some View {

        Model3D(named: "Earth")

    }

}

Hi @kaiberg

Did you ever run into the issue in Xcode simulator where the 3D asset is supposed to appear but all that shows is the progress view spinner? I can see the Model3D in preview but when I run the simulator all I see is the progress view spinner :/