How is it possible for code to distinguish between external USB hard drives and solid-state drives on the one hand versus USB sticks on the other hand?
I'm not familiar with macOS APIs (or system calls, interrupts, messaging, and other things) but I'm guessing it would be in I/O Kit or Disk Arbitration?
On the Terminal command line you can use system_profiler SPUSBDataType
and see this information listed under "Removable Media".
I've never written macOS or Swift code before. I learned just enough to get this proof of concept together. It only makes the two-way generalization as in my question: Removable and/or ejectable media vs non-removable non-ejectable media. DMGs are lumped with USB sticks and SD cards. Optical and floppy disks surely are too. I have no idea if there's such thing as a storage type where only one of "removable" and "ejectable" is true but not both...