What are best practices to write a Linux Software on macOS

It probably won’t be fully ported (if not done by some community effort), but there actually is a new implementation of Foundation planned which will then be “equal” on all Swift platforms see this blog entry and this forums entry (note that more according future topics for discussion are announced there) and also being discussed in other topics. (The usage of the new implementation might then require some adjustments in your code, e.g. because of the planned modularization.)