Last active
January 17, 2018 01:03
-
-
Save PulkitSethi1984/1a4151e48e3b87a6ed87c448bd870225 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Register("AppDelegate")] | |
public class AppDelegate : UIApplicationDelegate | |
{ | |
private void LoadDependencies() | |
{ | |
// Load dependencies in methods that run once per run of the application | |
IDependencyService serviceLocator = DependencyService.Instance; | |
if (null == serviceLocator.GetService<ILoginPresenter) | |
{ | |
ILoginPresenter presenter = GetPresenter(); | |
serviceLocator.AddService(presenter, typeof(ILoginPresenter)); | |
} | |
// Load other presenters | |
... | |
} | |
private ILoginPresenter GetPresenter() | |
{ | |
// return presenter that supports all features of the current device | |
... | |
} | |
} | |
// LoginViewController | |
public partial class LoginViewController : UIViewController | |
{ | |
private ILoginPresenter _loginPresenter = null; | |
public override void ViewDidLoad() | |
{ | |
base.ViewDidLoad(); | |
// Load presenter | |
_loginPresenter = DependencyService.Instance.LoadService<ILoginPresenter>(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment