Try to search your question here, if you can't find : Ask Any Question Now ?

Swift delegation pattern between UIVIewController and Service

HomeCategory: stackoverflowSwift delegation pattern between UIVIewController and Service
Avatarjulie asked 5 months ago

I am trying to create a FirebaseService in my swift app, which role will be to login and signup the user. I want to make it happen with a delegation pattern.

I did the following

  1. create LoginViewDelegate
  2. create weak var delegate: LoginViewDelegate in my LoginViewController

3.Conform to LoginViewDelegate in my FirebaseService and implement the method

  1. typed loginViewController.delegate = self in the firebaseService init

So I think the problem is that FirebaseService is not initialized, cuz in LoginViewController the delegate is nil when I call the function. I tried to instantiate it in LoginViewController but it crashes because I think a cycle reference is made

1 Answers
Best Answer
AvatarFernando answered 5 months ago
Your Answer

10 + 12 =

Popular Tags

WP Facebook Auto Publish Powered By :