A highly incomplete chat app written in Swift using Network.framework & Streams (client-side) and Swift NIO (server-side)
No 3-rd party libs used, this is a prototype of how chat funtionality is implemented using stream sockets.
-
Clone/download repo
-
Fetch dependencies and generate project:
cd .../{project directory}/NIOServer
$ swift package generate-xcodeproj -
Run server
$ cd .../{project directory}/NIOServer/Sources
$ open TCPServer.xcodeproj
build and run ('command + R' or from terminal: ‘$ swift run TCPServer’)
Note: in case you want to kill the process blocking your port:
$ lsof -t -i tcp: | xargs kill (or '$ sudo lsof -t -i tcp: | xargs kill')
- Run client:
$ cd .../{project directory}/Client
$ open NetworkFrameworkResearch.xcodeproj
command + R, fill host/port of the server
Run multiple simulators (ex. 7, 7Plus, 8)
Profit!