Hi, I'm writing an IRC client for macOS, in Swift, currently in it's early formation stage.
I have this ServerConnection
struct (not sure if it should be a struct, class or actor) that is solely responsible to initialise a connection to the IRC server, sends and receives messages.
It's not much code, and if you don't mind, I'd highly appreciate if you could check it out and let me know if I can write better and more idiomatic Swift code, especially async code.
In essence I'm not sure if the connect()
method I've extracted, should be called in the initialiser or if it should be called separate by whoever initialises the struct?
Also, I don't know how to handle possible errors that are thrown if say sending or receiving a message goes wrong.
The code file is on Github here.