Post

Replies

Boosts

Views

Activity

NSDockTilePlugin tutorial....
I'm trying to write a game for MacOS and I'd like to be able to provide a menu option, when the app isn't running, that allows them to jump straight back to the last game level they were playing. My limited understanding is that NSDockTilePlugins is the correct way to do this, as from MacOS 10.6, but I cannot find an actual Objective C tutorial from Apple on how to implement this correctly?Is this the only way to implement non-runtime menus? Can anyone please point me in the right direction?
12
0
2.2k
Dec ’19
IOKit: Retrieving USB Name, Vendor ID and Product ID after Serial Connection.
Firstly let me start by saying I'm totally new to using IOKit and fairly new to Swift. That said, I've successfully managed to detect the insertion and removal of my USB serial device in my Swift, MacOS app. Therefore calling ls /dev/tty.* lists the same devices as via the IOServiceAddMatchingNotification(notifyPort, kIOFirstMatchNotification, IOServiceMatching("IOSerialBSDClient"), matchingCallback, selfPtr, &matchedIterator) call inside the resulting callback. This is a great start. As you can imagine telling the user you've found "/dev/tty.usbmodem[some number]" isn't particularly user friendly. So once I retrieve the IODialinDevice property from the aforementioned callback is there a way for me to lookup the USB device's Vendor ID and Product ID and ideally retrieve the human readable name for said USB device, so I can then expose that to the User? Thanks.
4
0
2.9k
Oct ’21
IOKit is marked as Mac Catalyst 13.0+ compatible yet I'm unable to import it into my Swift iOS app
I'm currently working with IOKit on Mac (I'm new to it, but managed to get a Serial USB demo working) and noticed that it says that IOKit is Mac Catalyst 13.0+ compatible. But when I import IOKit into my iOS Swift project. I'm getting a No such module 'IOKit' error. Do I have to manually add this framework? I read somewhere that IOKit access may not be possible on iOS/iPad devices, if I released my app on the App Store, but what about internal home or company iOS devices, that won't ever be released on the App Store?? Thanks.
3
0
1.3k
Oct ’21
Make specific NSTabViewItem have focus depending on context
I have a custom NSTabViewController displayed from within an NSPopOver and as you can see from the image below, the NSTabViewItems contain custom NSButtons. My issue is that in order to support the latest Accessibility requirements, I would like to have the a specific tab have keyboard focus. Setting InitialFirstResponder does not work. Nor does calling MakeFirstResponder within ViewDidAppear, the normal way. The hack that works for me is within the NSTabViewController's ViewDidAppear override, I do a 250ms delay, on a background thread, and then call MakeFirstResponder on the NSButton I want focus on.This works as desired, but I'm not fond of hacks, so I'm looking for a more elegant and presumably more correct solution. I'm new to MacOS dev, so looking for the best practice solution, if there is one.
6
0
970
Dec ’19