■ I want to know
As a method of passing a value to the transition destination screen, segue.desitination is cast to the transition destination class in the "prepare" method to have a value.
The process is working fine, but I would like to know how to pass the value.

■ What I investigated
The process of passing the value is implemented in the following source. (The program is working properly)

@IBAction func nextButton (_ sender: Any) {
    performSegue (withIdentifier: "next", sender: nil)
override func prepare (for segue: UIStoryboardSegue, sender: Any?) {
    let nextVC = segue.destination as! NextViewController
    nextVC.count = count

We recognize the following about passing by value.

  1. Execute "perform Segue" at any time such as pressing a button
  2. Cast "destination" to the transition destination screen with "prepare For Segue" overridden on the transition source screen
  3. Set the value in the "destination" after casting with the variable name (count in this case) held by the transition destination screen.
  4. After the process of prepareForSegue, the transition destination screen is created based on the instance of "destination".
  5. Since the passed value is retained, it can be used in the processing of the transition destination screen.

■ Unclear points
After "prepare For Segue", I don't know where the process is going, so I can't confirm how the contents of "destination" are passed. ..
(The above 4 and 5 are just guesses)

If anyone knows, please let me know. Thank you.