Reputation: 644
I am trying to run a function only when a certain storyboard is active.
Example:
if view == secondStoryboard { //Don't know what to do here
functionOnSecondStoryboard("Test")
}
This may be a very simple fix, thanks for taking a look.
Upvotes: 2
Views: 567
Reputation: 321
What do you mean by active storyboard? If I understand what you're trying to achieve, you can get the storyboard from which a view controller was instantiated using
let storyboard = self.storyboard
//now you can compare it to other storyboards
if storyboard == storyBoardNumberOne {
}
You can get its name with key-value coding and compare the string names
let name = storyboard?.valueForKey("name")
But be careful using the KVC to get the name - this isn't a documented feature and I cannot guarantee if an app using it would be accepted in the AppStore.
Upvotes: 3