I'm looking into porting an old classic Mac OS game written in 68K assembler to run on the current version of macOS using SwiftUI and SpriteKit.
My current implementation is a Cocoa based shell written in Swift that I wish to change to use SwiftUI in an attempt to target Mac, iPhone, iPad and Apple TV.
There are a great number of tutorials and example code based on SwiftUI targeting iPhone/iPad but very little targeting macOS or Apple TV.
Is anyone aware of any SwiftUI macOS example code on forcing a macOS SwiftUI SpriteView to resize while keeping a set aspectRatio?
Something equivalent to my existing shell's working code -
My current implementation is a Cocoa based shell written in Swift that I wish to change to use SwiftUI in an attempt to target Mac, iPhone, iPad and Apple TV.
There are a great number of tutorials and example code based on SwiftUI targeting iPhone/iPad but very little targeting macOS or Apple TV.
Is anyone aware of any SwiftUI macOS example code on forcing a macOS SwiftUI SpriteView to resize while keeping a set aspectRatio?
Something equivalent to my existing shell's working code -
Code:
class GameViewController: NSViewController {
...
override func viewDidAppear() {
super.viewDidAppear()
if let window = view.window {
window.contentAspectRatio = NSSize(width: 4, height: 3)
window.update()
}
}
}