Splat 1.1.0
What's New
Service Location
Splat now ships with a built in Service Locator (#32). This allows you to register interfaces in your platform-specific code and use them in a Portable Library. While you can set up your own resolver using any 3rd party IoC container, Splat also has a quite capable built-in one that is configured by default.
// In the startup code for your app
Locator.CurrentMutable.Register(() => new AndroidAlertDialog(), typeof(IAlertDialog));
// Later, in your portable ViewModel
var alertDlg = Locator.Current.GetService<IAlertDialog>();
await alertDlg.ShowAlert("It worked!");
This feature is based on ReactiveUI 5.0's Service Locator, so the documentation in ReactiveUI also applies great here.
Logging
Continuing the "Steal from ReactiveUI" theme, Splat now also ships with a common logging platform (#33). This allows libraries to be able to handle logging in a framework-neutral way, while getting a sensible default logger that will just spew to stdout.
// Add this to your class
class Toaster : IEnableLogger
// Now, in your method code
this.Log().Warn("Oh no!");
this.Log().ErrorException("Something Bad happened", ex);
The ReactiveUI-based docs for this feature can be found here
Rectangle Additions
A new method has been added to Rectangle, called Copy
, which allows you to copy a Rectangle with modifications (#34) - thanks @tberman!