Does this kind of sending data violate MVC?

I need to send data from HomeVC to ResultVC using segue, is this kind of method violate MVC? Inside the ResultVC I created two store properties so that I can access to it in the prepare(for segue: UIStoryboardSegue, sender: Any?) method in HomeVC, can anyone please tell me whether this kind of method violate MVC? Your responses will be highly appreciate!

Code Block
class HomeVC:UIViewController {
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        if segue.identifier == C.segueToResultVC {
            let resultVC = segue.destination as! ResultVC
            resultVC.totalSplit = calculator.getSplit()
            resultVC.splitInfo  = calculator.splitInformation()
        }
    }
}
class ResultVC:UIViewController {
    var totalSplit:String?
    var splitInfo:String?
    override func viewDidLoad() {
        super.viewDidLoad()
        customizeViews()
    }
    override func viewWillAppear(_ animated: Bool) {
        totalPrice.text = totalSplit
        splitAndTip.text = splitInfo
    }




Answered by Claude31 in 653633022
That is the right way of doing it.

Just one comment.
On line 4, you take a risk (very limited) by forcing downcast.
You'd better write
Code Block
if let resultVC = segue.destination as? ResultVC {
resultVC.totalSplit = calculator.getSplit()
resultVC.splitInfo = calculator.splitInformation()
}

Accepted Answer
That is the right way of doing it.

Just one comment.
On line 4, you take a risk (very limited) by forcing downcast.
You'd better write
Code Block
if let resultVC = segue.destination as? ResultVC {
resultVC.totalSplit = calculator.getSplit()
resultVC.splitInfo = calculator.splitInformation()
}

@Claude31 Thank you so much for your suggestions, I will wait for few more suggestions and I will give you a vote :)
Does this kind of sending data violate MVC?
 
 
Q