Windows & Native Services
Call native.Run once from main. Its startup callback creates windows and registers application handlers.
#Window lifetime
native.NewWindow creates a window with its own component. Closing the window disposes that UI. Capture native.CurrentWindow() while constructing a component if a later callback needs the window handle.
Handle the Dock icon with native.App.OnReopen so a new window opens when none are visible.
#Commands and services
Use the typed native APIs for dialogs, clipboard, shell, appearance, menus, notifications, and other platform features. Operations that return a result use a completion callback — handle errors there instead of blocking. Tray icons are covered in Tray Icon.
For background work, ui.Async cancels when its component is disposed. native.Dispatch delivers a result back to the UI goroutine. Read and write signals only there.
Independent native packages use native.InvokeExtension and native.OpenExtension. See Authoring Extensions.
#Events and file watching
native.WatchFiles(paths, changed, ready) uses operating-system notifications and returns a stop function. Register the stop function with ui.OnCleanup for component-owned watchers. Prefer a native event or watcher over polling.
