0

I am trying to prompt an alert and request payment for premium features in my app before a segue happens, but shouldPerformSegue doesn't seem to be working. I have a SWRevealViewController that opens a side menu, from which I connected the segue manually in my Storyboard. I clicked the Segue and named identified it.

override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool {
    if identifier == "advanced_segue" {
        purchaseRequest()
        print("shouldPerformSegue working")
        return false
    } else {
    return true }
}

Please see attached picture. Example in Timeline

Hamish
  • 78,605
  • 19
  • 187
  • 280
Jacobo Koenig
  • 11,728
  • 9
  • 40
  • 75

2 Answers2

1

You are missing the segue class, try with SWRevealViewControllerSeguePushController or SWRevealViewControllerSegueSetController

garanda
  • 1,271
  • 11
  • 16
  • Thanks for your answer. Thats exactly what I thought, but I don't know how to access the cellClicked property of the SWRevealVC as I designed it manually. Could you please give me some pointers on that? – Jacobo Koenig Jan 18 '16 at 00:24
  • @JacoboKoenig It is the text box right below where you have "advanced_segue" in your storyboard inspector on the right. – Steve Moser Mar 28 '16 at 12:24
0

Put a break point on the if statement to make sure it is entering. If it is, then it might be due to the kind of segue. Try using the library's custom "reveal view controller push controller" segue type.

mcfisty
  • 187
  • 10
  • Hi, I have to print() statements in the function before and after the 'if' statement. None is being activated. I tried using different segues but none are working. Also, I should note that the side menu is segueing to another view unrelated with the Reveal View Controller. – Jacobo Koenig Jan 18 '16 at 15:48