Hi this may be a simple question and I apologize if it is on here already, I searched for what I could but couldn't find an answer that tailors to my specific situation.
Here is the issue. I am currently creating a text adventure to practice some iOS development using swift in Xcode 6 and in this case I have a text view in my view controller that can scroll to the bottom of itself and 2 buttons at the bottom of the screen. The point being that if you hit one button it segues you to a different scenario and also alters some general character stats from a class UserCharacter I defined in my project altering some basic data and vice versa for the other button.
Thing is in my segue I need to check which button the user pressed so I know which data to segue but can't quite figure out how to do that.
Here is what I have so far, (I have already passed my data once previously but didn't need to make a choice so it was fairly simple)
class RouteZeroViewController: UIViewController {
var character : UserCharacter?
@IBAction func choiceOneButton(sender: AnyObject) {
character?.strength += 3
character?.intelligence -= 2
}
@IBAction func choiceTwoButton(sender: AnyObject) {
character?.agility += 2
character?.intelligence += 2
character?.courage -= 2
}
@IBOutlet weak var textView: UITextView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
// set initial textView load at the top instead of middle/bottom
self.textView.scrollRangeToVisible(0)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using [segue destinationViewController].
// check for button one push ????????
var thirdSceneA = segue.destinationViewController as RouteOneAViewController
thirdSceneA.character = character
// check for button two push ????????
var thirdSceneB = segue.destinationViewController as RouteOneBViewController
thirdSceneB.character = character
}
}
Any help would be appreciated. Thank You..