Image generated by hotpot.ai

Over the last few weeks, I’ve had the opportunity to dive into the architecture of apps written in Swift. I’ve also wanted to implement a client for Remote Sensor Monitor, to check on my PCs temperatures while playing games (and avoid any overheating). The result of this research are two clients with the same functionality, but different implementations. I’ve also gained new insight into how to structure apps to provide more flexibility.

Remote Sensor Monitor

Remote Sensor Monitor (RSM) is a freeware console application for Windows, which exposes various measurements reported by HWiNFO, AIDA64 or Open Hardware Monitor to the network in JSON format.

I’ve set up RSM to start up automatically on boot, so that the measurements are available immediately after the PC starts up. With this in place, it was time to start working on the client application.

Sensor Reader - a peek into app architecture

After watching videos on EssentialDeveloper and PointFree, I was itching to experiment with different approaches on building apps from the ground up. I was particularly interested in ComposableArchitecture (TCA). I’ve encountered it a couple of times in the wild, but haven’t yet developed anything by myself with it. I’ve decided I want to display a list of all the readings and have a dashboard showing only favorites. I built a scaffolding, the required models, two views and supporting objects. I duplicated the project and developed one with TCA and the other with a mixture of everything I learned so far (an approximation of Clean Architecture). The goal was to have nicely separated responsibilities and clearly defined dependencies. I wanted to avoid implicit dependencies as much as possible to have code testable as well. I did not pay much attention to the user interface, since my focus was on the structure. It will definitely need a face lift sometime in the future.

Working on the TCA version of the client, it surprised me how it enabled me to get things done fast with clear structure and separation. I am very happy to have tried it out and even though I am a novice at it, I see myself using it to develop modules or entire applications with it.

The path forward

This is just one step of many into the vast world of architecting apps. It was a great experience and made me comfortable using different approaches to designing apps. Even though there is no silver bullet, knowledge of different paradigms is fundamental and can help immensely when thinking about designing an app or module from scratch.

Links to SensorReader and ComposableSensorReader