Platform-specific API
Include platform headers explicitly; the portable umbrella does not make a backend API available on another target. Platform integration code runs under the owning host’s thread and resource rules.
Typed view factories
Section titled “Typed view factories”PlatformViewFactory<Properties, Instance, Controller = void> retains a shared Instance, extracts its stable platform view once, and applies subsequent properties. create and view are required. Non-void properties require update; a controller requires both connect and disconnect. Optional dispose runs after controller disconnection.
| Header | Namespace | Creation context / extracted view |
|---|---|---|
<huxerui/android/platform_registry.h> |
android |
Current JNIEnv*, Android Context / local reference to the retained Java View. |
<huxerui/ios/platform_registry.h> |
ios |
UIViewController* / UIView*. |
<huxerui/macos/platform_registry.h> |
macos |
AppKit host context / NSView*. |
<huxerui/windows/platform_registry.h> |
windows |
Parent HWND / child HWND. |
<huxerui/linux/platform_registry.h> |
linux |
Borrowed GtkWindow* / unparented GtkWidget* owned by the retained instance. |
<huxerui/web/platform_registry.h> |
web |
Browser event loop / detached HTMLElement in emscripten::val. |
Register with ApplicationContext::RegisterPlatformView. Direct C++ properties/controllers keep their exact types. Do not return temporary platform views or retain borrowed callback contexts.
Android bridge and JNI
Section titled “Android bridge and JNI”The Android registry header also exposes PlatformEnv and GetPlatformEnv(UiWindow&) for the current UI-thread JNI environment/context, PlatformModuleFactory<Module, Options> for direct JNI factories, and JavaPlatformModuleFactory / JavaPlatformViewFactory for Java implementations.
Java factories identify a public, no-argument-constructible class by class_name. Their structured values cross through PlatformPayload; an optional typed facade/controller wraps PlatformChannel. Keep registration in a application hook.
<huxerui/android/jni.h> supplies UTF-8 and byte-array conversion and the move-only LocalRef<Reference>. It deletes only its owned JNI local reference. Never retain JNIEnv*; use explicit global references for Java objects that must outlive a callback.
JavaWindowPlatformModuleFactory adapts HuxerUIPlatformModule.WindowFactory for a module bound to an original HuxerUIView. Capture its HuxerUIActivityResultLauncher when creating the instance; retained launchers do not bind to replacement attachments. Android application-only JNI uses GetPlatformApplicationEnv(Runtime&); never cache JNIEnv*.
HuxerUIFileReference.fromUri(Context, Uri) creates a read-only retained file capability while source access is valid. It can block/copy and should run on an allowed worker; metadata does not grant write access. See Android.
android::OpenSeekableFileDescriptor(reference, access, mode) from <huxerui/android/jni.h> opens a compatible whole-file content URI on the calling thread. It returns a move-only android::FileDescriptor that retains provider access. Get() borrows the fd and Close() releases it. The operation accepts ReadOnly or ReadWrite for an existing file. A nonseekable source or a provider that needs reliable Java close signaling reports Unsupported. See descriptor ownership.
iOS scoped modules and presentation
Section titled “iOS scoped modules and presentation”ObjectiveCPlatformModuleFactory adapts HUXPlatformModuleFactory to an application host. ObjectiveCWindowPlatformModuleFactory adapts HUXUIKitWindowPlatformModuleFactory to its original UIViewController. WindowPlatformModuleFactory supports a direct Objective-C++ typed facade.
HUXGetPresentationCoordinator(owner) returns that controller’s shared main-thread presentation queue. Enqueued UI retains its slot through active cancellation until the finished callback confirms absence. Inactive windows defer admission; unmanaged modal UI can fail admission. See iOS presentation.
HUXFileReference.copyFromFileURL:error: (Swift FileReference.copy(from:)) snapshots a provider file into SDK temporary storage while the URL is valid. Retain the capability rather than only its URL; the last owner releases temporary content.
Web bridge and routing
Section titled “Web bridge and routing”The Web registry header offers JavaScriptPlatformModuleFactory and JavaScriptPlatformViewFactory. Supply the JavaScript factory object directly from the application hook; there is no second global registration table. Modules provide create/invoke/dispose, with optional request cancellation; views also expose a detached element and property updates.
<huxerui/web/navigation.h> declares BrowserNavigationStack(root, path, resolver, codec). The codec supplies Decode(location) and Encode(path); one stack owns same-document URL synchronization. This does not replace browser server fallback configuration for direct navigation.
Texture producers
Section titled “Texture producers”All producer objects derive from ExternalTexture; share them through std::shared_ptr.
| Header | Types and publication |
|---|---|
<huxerui/android/external_texture.h> |
BitmapTexture::Publish(JNIEnv*, jobject), GlTexture::PublishCurrent(Frame), and SurfaceStreamTexture for a platform surface stream. |
<huxerui/ios/external_texture.h> |
PixelBufferTexture::Publish(CVPixelBufferRef) and MetalTexture::Publish(Frame). |
<huxerui/macos/external_texture.h> |
AppKit equivalents of PixelBufferTexture and MetalTexture. |
<huxerui/windows/external_texture.h> |
PixelFormat, PixelFrame, PixelTexture, and D3D11Texture. |
<huxerui/linux/external_texture.h> |
PixelFormat, PixelFrame, PixelTexture, GlTexture, and immutable GdkTexture publication. |
<huxerui/web/external_texture.h> |
VideoFrameTexture::Publish(const emscripten::val&). |
Software PixelFrame publication copies straight-alpha RGBA/BGRA rows. GPU producers have format/context/synchronization constraints, not a universal “borrow any texture” contract. Read ExternalTexture integration before choosing one.
The concrete acquisition interfaces include android::GlFrame, windows::D3D11Frame, and linux::GdkFrame. The Apple producers return retained Core Video or Metal resources, and the Web producer returns a VideoFrame clone. See Acquire a published frame for the associated release and context requirements.
Windows installer UI
Section titled “Windows installer UI”<huxerui/windows/installer.h> exposes a specialized WiX Burn application boundary, not a normal desktop application service.
Install windows::InstallInstallerSession once in the installer’s window_hooks and enter through RunInstallerApplication() from the generated bootstrapper entry. UseInstaller() returns InstallerHandle; its status supplies product state, phase, progress, failure, and any outstanding prompt.
Install(InstallerInstallOptions), Repair(), Uninstall(), and Cancel() request engine operations. Installation options can override absolute destination and desktop shortcut choice. ChooseDestinationAsync(initial) returns an optional directory; cancellation is empty. Respond(prompt_id, choice) answers the identified prompt; stale IDs are ignored. Use this service inside the generated installer. The product states distinguish a fresh install, upgrade, downgrade and the exact same registered version. For an InstallerPromptKind::Restart prompt, Yes requests a restart and No defers it. Both choices close the installer.
Borrow a platform window
Section titled “Borrow a platform window”GetPlatformWindow(const WindowHandle&) is available from the platform registry headers on Windows, macOS, Linux, and iOS. In the respective namespaces it returns an HWND, NSWindow*, GtkWindow*, or UIWindow*. Use it on the owning application thread and treat the handle as borrowed. The query returns null for a window without a live attachment. Query again after deferred operations instead of caching the result across window closure.
On Android, android::GetWindowView in <huxerui/android/jni.h> returns a JNI local reference to the live HuxerUIView. Use and release it on the Android main thread in the current JNI reference frame. On Web, web::GetWindowRootElement in <huxerui/web/platform_registry.h> returns an emscripten::val holding the root HTMLElement. Use and release it on the browser main thread. Both queries return an empty value if the attachment is gone. HuxerUI owns placement and removal.
Boundary classification
Section titled “Boundary classification”Runtime/UiWindow host implementation machinery are not ordinary app APIs. Names in huxerui::detail remain internal even when templates mention them. See platform capabilities for implementation status and validation limits.
Buffer references and notification data
Section titled “Buffer references and notification data”The Apple registry headers also expose HUXBufferReference (Swift BufferReference), with retained-owner construction, scoped withUnsafeBytes access and slice(offset:length:). It is a read-only view of live storage, not a frozen snapshot. Keep the native allocation valid and coordinate mutation independently.
The iOS registry additionally exposes HUXGetLocalNotificationData(UNNotificationContent*) (Swift localNotificationData) for a Notification Content Extension to inspect the submitted payload. Validate the payload before using it; this is application data, not an authorization grant.
Windows URL and local-notification registration live in the explicit Windows namespace of the shared <huxerui/system.h> header. See System API.

