Skip to content
On this page

Realtime SwiftUI + Vapor

Server-side Swift? Why not? Let's build a real-time chatroom with Vapor and SwiftUI.

Vapor

Many associate Swift exclusively with mobile app development, often overlooking its potential on the server. The other day I thought, “Why not treat Swift like JavaScript/Node.js and use it server-side?” The truth is, Swift has been used on the server for many years. It has a rich ecosystem that includes the Vapor web framework and has an active developer community.

One thing I like about Node.js is the ease of building real-time apps with WebSockets (WS), explicitly using the socket.io framework. Building a simple chat room app with node, React (or whichever client-side JS framework you prefer) and socket.io is a breeze.

Let’s mix it up a bit.

For a fun intermediate project, let’s try building a simple web server using Vapor and an iOS client using SwiftUI to connect via WebSockets.

In addition, we’ll try the new Observation framework ⭐, which sounds very cool and could help clean up a lot of fluff in our codebases.

Read full article on Medium