79404392

Date: 2025-02-01 03:57:40
Score: 3.5
Natty:
Report link

In your MusicMonitor add @Published var songTitle: String = "" and update this wherever it is needed (eg in updateCurrentSong()). Declare @StateObject private var musicMonitor = MusicMonitor() in the parent View, and pass this model to other views. Then use Text(musicMonitor.songTitle) in your View. For iOS16, see Apple Monitoring data, for iOS17+ see Managing model data in your app – workingdog support Ukraine

Reasons:
  • No code block (0.5):
  • User mentioned (1): @Published
  • User mentioned (0): @StateObject
  • Self-answer (0.5):
  • Single line (0.5):
  • Low reputation (1):
Posted by: Oliemanq