Post

Replies

Boosts

Views

Activity

Reply to Sizing SpriteView inside a List
This seems to yield the desired result. It's not very elegant but it works: struct MyView: View { var scene: SKScene // this is a SKScene with .aspectFit scaling mode @State private var scaledHeight = 0.0 var body: some View { List { Section { SpriteView(scene: scene, options: [.allowTransparency]) .frame(height: scaledHeight) .background(GeometryReader { geo -> Color in DispatchQueue.main.async { scaledHeight = geo.size.width / scene.size.width * scene.size.height } return Color.clear }) } Section { Text("SomeOtherStuff") } } } }
Jan ’24