-1

Trying to create multiple classes in single view controller. I am using segue in order to navigate to next page,

    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {


    let dest : Analyze = segue.destination as! Analyze
    dest.age = ageField.text!
    dest.gender = genderField.text!
    dest.name = nameField.text!
}

The application has the same layout for each .swift file so my question is how can I segue to a different code without creating a new View Controller.

Maddy
  • 1,660
  • 11
  • 24
nadavs
  • 11
  • 5
  • You can't do that. Bcz segue means you pushing other VC into the navigation controller. So if you using Custom swift files then alloc them into your VC. – dahiya_boy May 31 '17 at 17:12
  • 1
    why you want to do this – Maddy May 31 '17 at 17:48
  • Possible duplicate of [How can I create one UIViewController with two views that display one or the other depending on button clicked](https://stackoverflow.com/questions/12146722/how-can-i-create-one-uiviewcontroller-with-two-views-that-display-one-or-the-oth) – koen May 31 '17 at 19:02

1 Answers1

0

If your app is having the same layout for each view controller then why are you using different view controllers? Why don't you just replace the data of current item with the next one. Maybe you can just create a custom array and replace the data with the next time every time user goes for next item.

Zohaib Hassan
  • 984
  • 2
  • 7
  • 11
  • each one of the .swift files has a very long and complicated algorithm, What im asking is if I can make it that each time im seguing the view controller shown will have a different .swift file using the same controls – nadavs Jun 09 '17 at 16:18