I am creating one framework in Objective-C. I have everything working fine in Objective-C project. But when I Integrate my framework with Swift project, it behaves strange.
My Swift Project:
- Just one ViewController and one button with IBAction connected.
Now:
- In
viewDidAppear
I have initialized my framework and setdelegate
toself
. - Once I get initialized successful delegate called, I call another method.
- but the strange behaviour is everything stopped, even
IBAction
is not working.
But when I tried to add NSTimer repeat method in viewDidAppear, everything working fine again.
I know this is very weird issue but might be someone has faced this.
My Code:
override func viewDidAppear(animated: Bool) {
MySDK.sharedInstance().initWithAppKey("123")
MySDK.sharedInstance().delegate = self
NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: "timer", userInfo: nil, repeats: true)
}
Delegate calls,
//This is getting called
func initSdkSuccessful() {
MySDK.sharedInstance().doStuff()
}
//This is not getting called
func stuffDone() {
}
IBActions,
//This is getting called if I do not set delegate,but if I set delegate to self then It doesn't.
@IBAction func btnTapped(sender: UIButton) {
MySDK.sharedInstance().doAnotherStuff()
}
Thanks