I'm making a Pomodoro app and adjusting the focus time using UISlider.I can access the UISlider value on the screen where I define the UISlider. But I want to switch to the previous screen. I failed. My first page is ViewController(), my second page is SettingsVC().
It's my 5th month in software. Very happy if you help.
import UIKit
class ViewController: UIViewController {
  
    let actionButton = SFActionButton()
    var minutesLabel = SFTimeLabel(text: "25")
    let secondsLabel = SFTimeLabel(text: "00")
    
    override func viewDidLoad() {
        super.viewDidLoad()
        view.backgroundColor = .systemBackground
    }
    
    @objc func controll(){
        print("Slider Value : \(SettingsVC().focusTimeSlider.value)")
        print("Working")
    }
    
    
    @objc func settingsAction(){
        let rootVC = SettingsVC()
        let navVC = UINavigationController(rootViewController: rootVC)
        navVC.modalPresentationStyle = .fullScreen
        self.present(navVC, animated: true, completion: nil)
    }
    
}
This code page is my first page.
import UIKit
class SettingsVC: UIViewController {
 
    
    //MARK: - Sliders
    
    var focusTimeSlider = UISlider()
    let shortBreakTimeSlider = UISlider()
    let longBreakTimeSlider = UISlider()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        view.backgroundColor = .systemBackground
        title = "Settings"
    }
    
    //MARK: - Done Button
    func addCloseButton(){
        let button = UIBarButtonItem(title: "Done", style: .done, target: self, action: #selector(onClose))
        navigationItem.rightBarButtonItem = button
    }
    
    @objc func onClose(){
        self.dismiss(animated: true, completion: nil)
        
        print("Focus Time       : \(Int(focusTimeSlider.value))")
        print("Short Break Time : \(Int(shortBreakTimeSlider.value))")
        print("Long Break Time  : \(Int(longBreakTimeSlider.value))")
    }
    
    
    //MARK: - Slider Actions
    
    func layoutFocusTimeSlider(){
        focusTimeSlider.addTarget(self, action: #selector(focusSliderValueChanged(sender:)), for: .valueChanged)
        
    }
    
    @objc func focusSliderValueChanged(sender: UISlider){
        focusTimeSliderValueLabel.text = String(Int(focusTimeSlider.value))
    }
    
    func layoutShortBreakTimeSlider(){
        shortBreakTimeSlider.addTarget(self, action: #selector(shortSliderValueChanged), for: .valueChanged)
    }
    
    @objc func shortSliderValueChanged(){
        shortBreakTimeSliderValueLabel.text = String(Int(shortBreakTimeSlider.value))
    }
    func layoutLongBreakTimeSlider(){
        longBreakTimeSlider.addTarget(self, action: #selector(longSliderValueChanged), for: .valueChanged)
    }
    @objc func longSliderValueChanged(){
        longBreakTimeSliderValueLabel.text = String(Int(longBreakTimeSlider.value))
    }
}
This code page is my second page.
 
    