How to get SKScene screen dimensions when using SpriteView

How do I get the visible screen area dimensions of SKScene while using Spriteview? I used to do :

let bottomLeft = convertPoint(fromView: .zero)

But when I do that now I get nan, nan

I read about GeometryReader, because its SwiftUI casting a SKScene (lack for better wording). So I should be able to get the needed information out of GeometryReader. But have no idea how.

What I basically need is information on what pixel the SKScene actually starts on bottom left, and where it ends top right. Due to aspect ratios this can vary on different screens, iPad, iPhone etc.

n/a

So, because I was completely stuck on this matter I requested code level support from Apple, and they came with this answer;

The reason you are receiving NaN is that you are calling these methods before the underlying SKView has been actually presented by SwiftUI, which is an event that you have no visibility into, and no way to call code when it happens. However, when this event does occur, the SKScene’s view property will have it’s window set from nil to a UIWindow. Therefore, you could use KVO to observe when the window property is changed, and then make your calls to convertPoint once there is a non-nil window.

Now , how the heck do I put an observer on SKScene to monitor change? I have 0 experience with Observe/KVO.

I have tried :

override func didMove(to view: SKView) {
        view.observe(\.frame.maxX, options: .new ) { object, change in
            print ("it has been changed")
        }
}

this gives me an error "Fatal error: Could not extract a String from KeyPath Swift.KeyPath"

and

override func didMove(to view: SKView) {
        view.observe(\.frame, options: .new ) { object, change in
            print ("it has been changed")
        }
}

but this doesn't seem to be called when it is changed.

any help would be appreciated.

How to get SKScene screen dimensions when using SpriteView
 
 
Q