DEV Community

MN IN
MN IN

Posted on

Building MoonSound: a SwiftUI desk clock with audio, widgets, Live Activities and iCloud sync


I recently shipped MoonSound, an iOS app that combines a full-screen clock, a white-noise mixer and a Pomodoro timer.

The user-facing idea is simple: turn an iPhone or iPad into a calm desk companion. The implementation ended up touching more native iOS APIs than I expected.

The app is built with SwiftUI and an MVVM structure. The main screens are intentionally immersive: clock, focus and sounds live in a paging container, while the navigation controls auto-hide so the device can sit on a desk without feeling like an app screen.

Some implementation details that were interesting:

  • AVFoundation handles looping sound playback and background audio.
  • Multiple sound tracks can play at once, each with independent volume.
  • Sound categories are loaded with on-demand resources instead of putting everything in the initial app binary.
  • ActivityKit powers the Lock Screen and Dynamic Island focus countdown.
  • WidgetKit provides clock, focus and sound widgets in home-screen and Lock Screen families.
  • App Intents expose actions like playing a mix, stopping sounds and starting focus sessions to Siri and Shortcuts.
  • NSUbiquitousKeyValueStore syncs custom mixes, favorites, recents and focus history.
  • HealthKit can write completed focus sessions as Mindful Minutes, but only after the user enables it.

One design decision I liked: the focus timer can fade out the current sound mix at the end of a round, then resume it on the next round. If the user manually changes the sound, the app respects that and drops the automatic resume snapshot.

MoonSound is not a complicated app from the outside, but it was a good reminder that small utilities often become better when they lean into the platform instead of trying to build everything themselves.


App Store:
https://apps.apple.com/us/app/moonsound-clock-white-noise/id6761410056

Top comments (0)