class ViewController: UIViewController { var userService: UserServiceInterface = UserService.shared func login(email: String, password: String, completion: ((Bool) -> Void)) { // .... userService.login(email, password, completion: { (success, error) in if success { completion(true) } completion(false) }) } } // And make the Service implement the interface protocol UserServiceInterface { func login(email: String, password: String, completion: (Bool, Error?)) } class UserService: UserServiceInterface { // .... }