It shows a black screen because you passed an empty scene to the sprite view.
SpriteView(scene:MapScene())
Calling MapScene() creates an empty scene.
You must add a property to your view that holds the scene to show in the sprite view. Call newGameScene to initialize it.
@State var mapScene = MapScene.newGameScene()
I haven't tested that line of code so you may have to make some changes to get it to work. But it gives you an idea of what you need to do.
Pass that property to the sprite view.
SpriteView(scene: mapScene)
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: