At login, I am trying to store some user preferences only for iOS, in NSUserDefaults from the PCL project. I can check for plaform with device.iOS? And do I use dependency injection to trigger the ios specific code while in PCL? If this is correct how exactly do I use dependency injection and if im wrong what is the best way to do it?
Answers
If you just want to store some simple data in PCL. you can try to use Properties Dictionary.
You can also use dependency service to implement the data storage on each platform.
NSUserDefaults
is used on iOS, for Android try to useSharedPreferences
.Moreover there're several libraries used for storing data for Xamarin.Forms. https://github.com/jamesmontemagno/SettingsPlugin this plugin will also be a good choice.