Nishad
Nishad

Reputation: 203

How can I add base URL and additional parameters in this Segue

Here is my code:

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {

    let playerViewController = segue.destinationViewController as! PlaybackViewController

    playerViewController.videoID = channelsDataArray[selectedVideoIndex]["ID"] as! String
}

How can I add base URL and additional parameters in this Segue?

Upvotes: 1

Views: 35

Answers (2)

Alexander Zimin
Alexander Zimin

Reputation: 1710

if I understand you correctly, you want to pass something in segue?

You can do it will something like this:

let url = NSURL(string: urlString)
self.performSegueWithIdentifier(segueIdentifier, sender: url)

Then in your prepareForSegue method do:

playerViewController.baseUrl = sender as! NSURL

Upvotes: 0

LuKenneth
LuKenneth

Reputation: 2237

Any additional data you wish to send to your segued view controller you can write as parameters in that view controller.

In the view controller class:

var varName = value

Inside prepare for segue:

playerViewController.varName = newValue

You can repeat this process for any additional data you need.

Upvotes: 1

Related Questions