Posts

Post marked as solved
1 Replies
Okay, it was pretty simple. The press handlers for both begin and end should be overridden and handle the input override func pressesBegan(_ presses: Set<UIPress>, with event: UIPressesEvent?) { /* Do nothing, or handle specifically the keys that should be processed by your app. super.pressesBegan will forward the key press and result in the 'beep' sound/ } override func pressesEnded(_ presses: Set<UIPress>, with event: UIPressesEvent?) { /* Do nothing, or handle specifically the keys that should be processed by your app. super.pressesEnded will forward the key press and result in the 'beep' sound/ } This solves the issue of 'beeps' coming from key presses that I am not currently handling while polling using GCKeyboard - https://developer.apple.com/documentation/gamecontroller/gckeyboard
Post not yet marked as solved
12 Replies
Not only webview...Custom Metal rendering is not appearing on macOS with Catalyst while it appears just fine on iOS device.And the frame debugger is showing me its rendering just fine. Just totally blank on my macOS retina display 😟
Post not yet marked as solved
4 Replies
This I believe is due to overhead involved with the debug tracking of Metal commands. I would love an official Apple response on this, but I think it’s safe to assume this 0.1mb increase will not exist in a release build of your application. Anyone from Apple have ideas about what causes this tiny memory leak even in the template apps?
Post not yet marked as solved
7 Replies
Nope. Spent a whole day trying to use VSplitView and HSplitView. They must be bugged atm.
Post marked as solved
2 Replies
Hi Dmitry,For embedding AppKit into SwiftUI the correct way form what I can currently tell is using either NSViewControllerRepresentable or NSViewRepresentable protocols.The collection view should be built with AppKit as was done before SwiftUI existed. In the case of embedding AppKit content, think of SwiftUI and just a markup language for displaying and organizing your UI instead of storyboards of nibs.I have been able to accomplish embedding of a MetalKit view using NSViewControllerRepresentable protocol just recently and it seemed to work okay (was rendering within the SwiftUI view heirarchy just fine)import Foundation import SwiftUI import AppKit struct ModelViewController : NSViewControllerRepresentable { typealias NSViewControllerType = GameViewController func makeNSViewController(context: NSViewControllerRepresentableContext) -> GameViewController { let viewController = GameViewController() return viewController } func updateNSViewController(_ nsViewController: GameViewController, context: NSViewControllerRepresentableContext) { // Protocol stub } }Where GameViewController was the NSViewController.import Foundation import AppKit import MetalKit class GameViewController : NSViewController { var renderer: Renderer! var mtkView: MTKView! override func loadView() { mtkView = MTKView() self.view = mtkView } override func viewDidLoad() { super.viewDidLoad() // Select the device to render with. We choose the default device guard let defaultDevice = MTLCreateSystemDefaultDevice() else { print("Metal is not supported on this device") return } mtkView.device = defaultDevice guard let newRenderer = Renderer(metalKitView: mtkView) else { print("Renderer cannot be initialized") return } renderer = newRenderer renderer.mtkView(mtkView, drawableSizeWillChange: mtkView.drawableSize) mtkView.delegate = renderer } }Pretty standard nothing special.Then you can just use the ModelViewController directly in SwiftUIimport SwiftUI struct ContentView : View { var body: some View { ModelViewController() //LOOK: My NSViewController wrapper } } #if DEBUG struct ContentView_Previews : PreviewProvider { static var previews: some View { ContentView() } } #endifHope this helps you. As I was also struggling to find any samples related to embedding AppKit related content...