Skip to content

Instantly share code, notes, and snippets.

@luismts
Last active December 10, 2018 01:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luismts/1e72a4137de371adcfa9e9734af5e50c to your computer and use it in GitHub Desktop.
Save luismts/1e72a4137de371adcfa9e9734af5e50c to your computer and use it in GitHub Desktop.
/// XF Project
namespace UsingDependencyService
{
public interface IToDo {
void ToDo (); //note that interface members are public by default
}
}
namespace UsingDependencyService.Service
{
public void DoSomething()
{
...
DependencyService.Get<IToDo>().ToDo(); // DependencyService Call
...
}
}
/// Android Project
[assembly: Dependency (typeof (ToDo_Android))]
namespace UsingDependencyService.Android
{
public class ToDo_Android : IToDo
{
public void ToDo ()
{
... // here your things to do
}
}
}
/// iOS Project
[assembly: Dependency (typeof (ToDo_iOS))]
namespace UsingDependencyService.iOS
{
public class ToDo_iOS : IToDo
{
public void ToDo ()
{
... // here your things to do
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment