I have one main ControllerView with two container view on top of each other (containerA on top of ContainerB). both containerView has a ControllerView. I am running a timer in each ContainerView. problem I am facing is that when I hide ContainerB to show ContainerA, the timer of containerB still running in the background, which is causing over 100% CPU use.
can any please help me how to stop the timer when I have other containerView visible? I am using two buttons to hide and show the container views.
ContainerA timer code:
ViewATimer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: (#selector(self.update)), userInfo: nil, repeats: true)
container B:
ViewBTimer = Timer.scheduledTimer(timeInterval: 10, target: self, selector: (#selector(self.secondUpdate)), userInfo: nil, repeats: true)