Alan Grgic
@spellgrgicright
- Software Development
- Board Games
- Metal Music
- Corgis
- Beverages
- Vibration
- GPS
- Accelerometer
- Local File System
- Battery Info
- Flashlight
- Phone Dialer
- etc.
Platorm-Specifics
Xamarin
netstandard
- Service Locator Pattern
- Factory Pattern
- Move all the plugin logic into separate projects
- Platform-specific projects contain only sdk code
- Plugin.Shared is referenced by all other projects
- PluginImpl implements the IPlugin interface
- CrossPlugin is a singleton factory of PluginImpl
Native SDK
netstandard business logic
netstandard plugin
???somehow native sdk code executes???
- The netstandard project of your plugin is never actually executed.
- By adding a reference to the platform-specific library, the netstandard output project gets overwritten (switched) at build time since we made the two assemblies have the same name and version number!
- Create a nuspec file that describes our deliverables and dependencies
- Bundle the netstandard dll and each platform dll all together in one pkg
- Each dll is only installed to its corresponding target platform
- Need to install the NuGet pkg on all projects
- From that point, the "Bait and Switch" trick takes over
- One library that contains several common plugins in one pkg
- Linking/tree shaking removes unused plugin code from builds
- Currently in preview and active development
- Source: https://github.com/xamarin/essentials
- Documentation: https://docs.microsoft.com/en-us/xamarin/essentials
Alan Grgic
@spellgrgicright