import UIKit class RollViewController: UIViewController { func randomDiceValue() -> Int { let randomValue = 1 + arc4random() % 6 return Int(randomValue) } @IBAction func rollTheDice(){ var controller:DiceViewController controller = self.storyboard?.instantiateViewControllerWithIdentifier("DiceViewController") as! DiceViewController controller.firstValue = self.randomDiceValue() controller.secondValue = self.randomDiceValue() self.presentViewController(controller, animated: true, completion: nil) } }