Post

Replies

Boosts

Views

Created

Metronome issue
I am trying to add a metronome feature to a music app. I have implemented the metronome as a class by using code from https://github.com/Nirma/Metronome and my app runs. However, after 1 second, the metronome slider resets back to zero. Is it something to do with the class being destroyed after 1 use? I'm not sure, so any solution would be appreciated.  VStack {           MetronomeView()             Text("\(timeString(time: timeRemaining))")                 .font(.largeTitle)                 .foregroundColor(.white)                 .padding(.horizontal, 20)                 .padding(.vertical, 5)                 .background(Color.customColour.opacity(0.75))                 .clipShape(Capsule()) The above code shows how I have added the view into a VStack.
1
0
624
Jan ’23
Initialising a variable using another variable in a list
I am new to swift and creating a music theory app. To make it more readable, I would like the colour of each topic to change depending on the difficulty (ie 1 = green, 2 = orange, 3 = red). However, I cannot reference another variable (difficulty) when initialising the variable 'colour' using my function. I'm not sure how to fix this error: "cannot find 'difficulty' in scope" on lines 36-39. Thanks
1
1
395
Sep ’22