A cross-platform library for .NET providing service location, logging, image loading, and geometry primitives to reduce platform-specific code.
Splat is a .NET library that provides leaky abstractions over platform-specific APIs to enable cross-platform development with fewer #ifdef directives. It solves the problem of writing shared codebases that need to handle graphics, logging, dependency injection, and other tasks consistently across WPF, Windows Forms, WinUI, MAUI, Avalonia, and other platforms. The library offers escape hatches like ToNative() and FromNative() methods to access platform-specific APIs when needed.
.NET developers building cross-platform desktop and mobile applications targeting multiple UI frameworks like WPF, WinUI, MAUI, and Avalonia. It is particularly useful for teams maintaining shared codebases that need to abstract platform-specific tasks such as image loading, logging, and dependency injection.
Developers choose Splat over alternatives because it provides a pragmatic, leaky abstraction that simplifies cross-platform code while allowing direct access to native APIs when necessary. Its high-performance, AOT-optimized dependency injection container and built-in adapters for popular logging frameworks and APM tools reduce boilerplate and improve consistency across platforms.
Makes things cross-platform
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The new GenericFirstDependencyResolver offers lock-free reads and constant-time service resolution, with benchmarks showing 3.5x faster performance and 18x less memory allocation than the legacy resolver, ideal for high-performance applications.
Provides consistent APIs for logging, image loading via IBitmap, and geometry primitives across WPF, MAUI, Avalonia, and more, reducing #ifdef directives in shared codebases.
Includes ready-made adapters for Serilog, NLog, Log4Net, and Microsoft.Extensions.Logging, allowing seamless logging strategy implementation without platform-specific code.
As a leaky abstraction, Splat offers ToNative() and FromNative() methods to access platform-specific APIs when needed, balancing abstraction with practicality for complex scenarios.
Features are split across numerous NuGet packages (e.g., Splat.Log4Net, Splat.Drawing), leading to dependency management overhead and potential versioning conflicts in large projects.
Application Performance Monitoring components are marked as 'Alpha' or 'Prototype' in the README, with error reporting listed as 'TODO', indicating they may lack production-ready reliability.
Configuring logging adapters or APM tools requires specific initialization steps and deep understanding of Splat's service locator, which can be error-prone and poorly documented for beginners.