Search code examples
iosswiftbwwalkthrough

Type BWWalkthroughViewController does not conform to protocol 'LoginViewController'


I am trying to integrate the library BWWalkthrough (https://github.com/ariok/BWWalkthrough). I was able to successfully get the walkthrough to work. I am trying to add login/register buttons on top of the walkthrough views like shown below. And this is where I am facing the issue.

Refer the pic below: enter image description here

The Sign in and "not a member" buttons should launch the login and register view controllers respectively. Since this 2 buttons are made in the BWWalkthroughViewController, I tried adding the IBAction in the said controller and got the error "Type 'BWWalkthroughViewController' does not conform to the protocol 'LoginViewController'". I have searched everywhere, but not able to crack this puzzle.

Codepen with relevant code pieces are here: http://codepen.io/anon/pen/aONBVP?editors=001

//RegisterViewController
// Defined the delegate
import UIKit
import Parse

@objc protocol RegisterViewControllerDelegate {

}

class RegisterViewController: UIViewController, UITextFieldDelegate {

var delegate: RegisterViewControllerDelegate?

// BWWalkthroughViewController
// the troubled code

@IBAction func loginButtonTapped() {
}

@IBAction func registerButtonTapped() {
    println("registerButtontapped")

let stb = UIStoryboard(name: "Main", bundle: nil)
let register = stb.instantiateViewControllerWithIdentifier("register") as     RegisterViewController

register.delegate = self //the buggy line
// error is: Type 'BWWalkthroughViewController' does not conform to protocol 'RegisterViewControllerDelegate'
self.presentViewController(register, animated: true, completion: nil)

}

I have followed the youtube tutorial: https://www.youtube.com/watch?v=O2mbveNs-0k for integrating BWWalkthrough. The relevant sections of the video are around 11 minute and 15 minute.

Can some kind soul help me fix this? Please :)


Solution

  • The brilliant Simon Archer (http://www.simonarcher.me/blog/wp/ who had created the youtube guide) answered my query on youtube and I am sharing it here:

    "Hi Talvinder, thanks for taking the time to watch the video. What you are experiencing is unfortunately an issue that arised with version 1.2 of Swift (and with iOS 8.3). I will have to update the video, but the author of the BWWalkthrough library (version 0.5) has made the updated changes to his demo project, which you can in the meantime can compare his code in that segment and see how it should be handled with Swift 1.2. Thanks again, and I hope this helps!"

    I commented out the login.delegate = self line and issue was resolved.