Skip to content
Welcome to our documentation!

Native Hosting

For .NET native apps that don’t use MAUI, Shiny provides base classes that wire up all the platform lifecycle hooks automatically. You inherit from Shiny’s base classes and override a single method to configure your services.

  1. Install the NuGet package

    NuGet package Shiny.Hosting.Native
  2. Create your platform entry points

    Inherit from ShinyAppDelegate:

    using Shiny;
    using Shiny.Hosting;
    using Foundation;
    using UIKit;
    namespace YourNamespace;
    public class MyDelegate : ShinyAppDelegate
    {
    protected override IHost CreateShinyHost()
    {
    var builder = HostBuilder.Create();
    // Register your Shiny modules and services here
    return builder.Build();
    }
    public override bool FinishedLaunching(
    UIApplication application,
    NSDictionary launchOptions)
    {
    // Your launch code here — don't call Shiny before base
    return base.FinishedLaunching(application, launchOptions);
    }
    }

Mac Catalyst apps use the iOS / Mac Catalyst tab above — ShinyAppDelegate inherits from UIApplicationDelegate and works out of the box.

Native macOS (AppKit) has no Shiny base class to inherit from. Use the MAUI macOS backend with an NSApplicationDelegate that inherits from MacOSMauiApplication, register Shiny services directly on builder.Services, and forward the NSApplicationDelegate push callbacks to Host.Lifecycle if you’re using Shiny.Push. See the MAUI hosting → macOS (native) section for the full wire-up.

Shiny modules with native macOS support: BLE, BLE Hosting, Notifications, Push, Battery, Connectivity.

Linux has no hosting model at all — there are no OS-level lifecycle callbacks to wire. Register Shiny services directly on your IServiceCollection (whether that’s builder.Services on a MAUI GTK4 app or a plain ServiceCollection() in a console app). Nothing extra is needed.

Nothing extra is needed. Blazor has no native lifecycle to wire up — register Shiny services directly on builder.Services in your Blazor Program.cs:

var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.Services.AddBluetoothLE();
builder.Services.AddGps();
await builder.Build().RunAsync();