Stop timer in order to change speed

HStack{
Button(“Start Timer”,action: {
timerSpeed = 60 / bpm
if notes[0] != “”{
Timer.scheduledTimer(withTimeInterval: timerSpeed, repeats: true) { timer in

                        if timerOn == true {
                            barCounter += 1
                            if barCounter > bpb {
                                barCounter = 1
                            }
                            if barCounter == 1 {
                                
                                counter += 2
                                if counter >= notes.count - 1 {
                                    counter = 5
                                    
                                }
                            }
                            
                            n3 = notes[counter]
                            n4 = notes[counter + 1]
                            
                        }
                    }
                    
                }
                else{
                    n3 = "Select a song!"
                }
                
        ...        
            }).foregroundColor(Color.black).fontWeight(.none)
                .background(Color.cyan)
            
            
            Button("Stop Timer") {
                timerOn = false
            }.foregroundColor(Color.black).fontWeight(.none)
                .background(Color.cyan)
            
            Button("Resume") {
                timerOn = true
            }.foregroundColor(Color.black).fontWeight(.none)
                .background(Color.cyan)
        }.font(.title)
            .fontWeight(.semibold)


Above is the code for the 3 buttons for the timer. The stop button just pauses the timer. I need a way to totally shut down the timer. As it is now, if I want to change the beats per minute I have to totally shut down the app or the speed doesn’t change.