Create "Screen" like command in macOS application

I am trying to create a screen like function that would be used in terminal but in a macOS application where the user can send and receive data to a /dev/cu.usbmodem*.

I am doing this in a macOS application and not a Command Line tool because I need to be able to access cloudKit easily.

I haven't found much of any info on this? IDK if it matters but I could code c, c++, or Swift file if that makes this possible.

Not sure where I should tag this thread either. Sorry I'm new to forums.

Is this a possibility?

I've tried to use the SerialSample program on Apple's Developer site but haven't been able to get the data back that would receive in a terminal screen. It does connect to the usbmodem and at the correct baud rate but the data is incorrect. This is most likely an error in my usage so I will also listen to suggestions for that method if it's the only way to achieve my above goal.

Create "Screen" like command in macOS application
 
 
Q