## making an app [^1]

WIP mac (+ios?) app to stream music from my Navidrome[^2] server. Not because I hate the ones available but because I tried [Sonar](https://b123400.net/sonar/) and liked the list view and wanted to replicate it but pretty and on my phone too maybe.

big caveat!! -> i've never made an app before, also learning swift/swiftui as i go

so far in what i've learnt it looks like creating the ui/modelling the data is pretty easy, the big thing i'd like to do that i'm not sure about is storing the music library data locally, which either means big blocking scans of navidrome or some kind of background sync/data load process(?)

i guess the alternative is doing it cache style?? fetch and store locally as i go?? idk

there's some helpful inspo and stuff i can reference in [this project](https://github.com/kepelet/flo/blob/develop/flo/Shared/Models/Subsonic.swift) 
### wip notes
- modeling navidrome response in a struct
- creating shared api client instance for app that:
	- gets server URL from somewhere
	- gets user/pass from somewhere
	- handles formulating token, storing it, and refreshing it when it expires


enum PlayerState 
- playing
- paused
- stopped

Handling settings in their own class like any other persistent data?? Is there a better way??

subsonic api response struct

api handler/manager that: 
- gets server url and user from data(?) keychain?
- creates stores and refreshes token
- is a like singleton class thing, exposes shared ver of itself
- makes get and post requests
- decodes responses form server and returns them in nice struct

library manager that:
- uses api client above
- syncs new artists and albums and tracks to stored data model
- cleans up objects representing stuff no longer in library
- does this as a background task, relying on swiftui to update views if data changes
- sync state enum tracking if syncing is happening or ready to go or done
- another singleton class, so we can trigger syncs from other views 
- extension
  - ability to sync by artist or album so we could do it in the background when users access

probs makes sense to have the player/queue stuff handled as like a single instance class thing, then all buttons and views can reference that too

where to add logic that updates the db with new data/cleans up old data?? to model? api client? it’s own thing?? trigger from task tho i guess

update list view with a selector toggle in the toolbar to list by artist, album, or track. if album is selected for example we can change the top level for each to use our releaselistitem rather than artist list item, and same if track is selected?? it will also need to change the query!! 

search should influence the query parameter tooooo, search string should show matches based on artists, release names or tracks maybe

add duration to tracks / releases in ui? 

[^1]: created 18/9/25, updated 24/9/25
[^2]: [navidrome](https://www.navidrome.org)
