Different people different way of learning. Yes, there are many different tutorials and what not, but some of them don’t suit me, or some of them won’t suit someone else. I think it’s good to have more content being created.

Also, some of the content that people publish is not updated, so when new content is created it also replaces some of the old resources with updated examples.

Yea, I feel that most of the frameworks that Apple provide are targeted to higher layers of the network stack. NIO is supposed to work in lower layers, but like you, I haven't really tried it. What I would do is use BSD sockets, which is hard to find proper documentation for Swift.

I did some research and documented it on a article, I posted it here a while ago. have a look:

Yea, good points. It will depend on where is the complexity of the system. For some cases, a "matrix" representation could also be problematic. If we end up with a gigantic structure that we have to navigate every time we want to change state, then the bottleneck will be the algorithm we use to navigate the matrix.

Yea you are right, a library might not be necessary. Using enums and generics, is a nice way to model it also :) I like that approach.

The only drawback form using enums is that they are value types, so when passed around you get a copy, not a reference. So There might be cases where you would like references to your state, not a copy.

In regards to Homebrew, the method in the example also works for libraries installed via brew. The only difference is the header files location. Homebrew stores the libraries headers in /usr/local/include/. So you could use the same method. But there is another option using providers in the Package.swift declaration.

In the related notes section, I briefly mention providers. SPM support providers in the Package.swift declaration, currently only apt and brew are supported. What the providers indicate is that the system library is provided by a package manager, so SPM knows to search for the default directories where those package managers install system libraries.