c# - Xamarin Native Dependency Service -


i little bit new xamarin , i've made project xamarin.forms , used lot dependecyservice. have project need make native specefic views not using xamarin.forms, know our pcl code still can same, if have methods require specific platform implementation can use dependency service.

as example , have method require save in phone path ,this method in pcl, path need xamarin.android , xamarin.ios.

can explain me how shall proceed ? thanks

the simplest without dependency injection create interface in pcl. create concrete class implement interface in ui project. after initialize , store instance of interface in singleton instance in pcl.

if want use dependency injection, there many library available use too. can refer post there abstraction layer on major ioc containers.

i have use simpleinjector directly nuget in xamarin native project too. working quite well.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -