I am trying to teach myself Xamarin forms but am having a hard time wrapping my head around how activities and shared code interact with the application specific MVVM.. from what I can gather the model part can be accessed from both the viewmodel and say the main activity, and in turn main activity can access shared code? It feels like all the reference documents are missing out the relationship with activities and shared code?
So if I wanted to make an app that could scan an NFC tag and relay that info to a REST service I would need to create a shared code object API client, platform specific NFC (mainactivity.cs?) And then bind to a model to put data onto the UI?
The aim for MVVM is complete isolation between business logic, UI and data models.
So, given your scenario, you would create your android view, most likely in AXML. Any logic you would generally do in an Android activity, would be done in a ViewModel, in shared code.
You would then create the REST API client connectivity in shared code, perhaps under a services folder for example. As this is functionality that does not need to be platform specific. All platforms can use this as is.
From the ViewModel you can then call the REST API and populate your models, which will be called from the views - ie. the activity will have reference to the ViewModel and any Models the ViewModel contains.
When it comes to your NFC scenario, you will write NFC methods in the ViewModel, you will then use something like Dependency Service to determine the platform, which will then run the NFC logic, written in each platforms project.
This then means that when you introduce iOS or other platforms, you can re-use that Model and ViewModel, which will then call the NFC logic written in the iOS project.