it is closest I could find
Not a problem. However, there is a better topic area, Core OS > Drivers and Device Access, and I’ve moved you thread there.
have been disappointed with the lack of Apple documention supporting serial port programming.
There’s two parts to this:
Discovering the available serial ports (A)
Talking to a serial port (B)
With regards B, macOS is much like any other BSD-flavoured UNIX, and you should consult standard UNIX resources on this topic. My ‘go to’ book for this sort of thing in Advanced Programming in the Unix Environment, although I must admit that I haven’t specifically consulted it for serial programming advice. Oh, and I’m two editions behind!
With regards A, the canonical example of how to find serial ports is SerialPortSample.
All of the above assumes that you’re coming from a C-based language. Doing this stuff in Swift is challenging because the relevant APIs do not have nice Swift wrappers (at least not from Apple). You’ll need to learn how to work with C APIs from Swift. The information in Imported C and Objective-C APIs can help.
Are there recommend swift libraries/frameworks for interacting with serial devices via USB?
To be clear, the USB-ness doesn’t matter here. Serial ports are exposed to apps in a way that’s independent of how they’re connected.
As for Swift-friendly higher-level APIs for serial, I don’t have any suggestions for you, alas. I’m sufficiently familiar with the low-level APIs that I just use them directly. Hopefully someone else will chime in.
Share and Enjoy
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"