mobile
Every export of @kitr/mobile, @kitr/mobile/client, @kitr/mobile/provider, read from the published type definitions. The guide shows them in use.
@kitr/mobile
addScheme
function addScheme(target: MobileTarget, source: string, scheme: string): string;
Add scheme to a native project's Info.plist (CFBundleURLTypes) or Android manifest (an
intent filter on the launcher activity). Returns the source unchanged when it is already there
or the file has no place for it.
declaresScheme
function declaresScheme(target: MobileTarget, source: string, scheme: string): boolean;
Whether a native project's Info.plist or manifest already declares scheme.
mobile
const mobile: import("@kitr/core").PlatformFactory<MobileOptions>;
iOS and Android through Capacitor. The native projects live in platforms/<name>/ios and
platforms/<name>/android; the app bundle is the same client build the web platform ships.
platforms: { phone: mobile({ targets: ['ios', 'android'] }) }
kitr dev phone --target ios # live reload on a simulator or device
kitr build phone # builds the web bundle and syncs it into both projects
schemeFiles
const schemeFiles: Record<MobileTarget, string>;
Where each native project declares its URL schemes.
MobileOptions
interface MobileOptions {
/** Which native projects to create and run. Default both. */
targets: MobileTarget[];
/** Reverse-DNS bundle id. Default `com.example.<app>`. */
appId?: string;
/** Name shown on the home screen. Default the package name. */
appName?: string;
/**
* Custom URL scheme for deep links (`acme` opens `acme://...`). `kitr build` and `kitr dev`
* register it in the iOS Info.plist and the Android manifest; `kitr doctor` checks it is there.
*/
scheme?: string;
/** Dev server port the device loads from with `kitr dev <name>`. Default 3100. */
port: number;
/** Extra Capacitor config merged last (`plugins`, `server`...). */
capacitor?: Record<string, unknown>;
}
Options of the mobile platform, as written in mobile({ ... }) in kitrrc.ts and edited by kitr config <name>.
MobileTarget
type MobileTarget = 'ios' | 'android';
A native project the mobile platform creates and builds: ios (Xcode) or android (Android Studio).
@kitr/mobile/client
capacitorPlatform
function capacitorPlatform(): Platform;
'ios' | 'android' | 'web'. Reads the global Capacitor runtime, so it is correct before any import resolves.
isCapacitor
function isCapacitor(): boolean;
True inside the iOS or Android shell: detectRuntime() says capacitor.
isPluginAvailable
function isPluginAvailable(name: string): boolean;
True when the native shell registered the Capacitor plugin name ('App', 'Share'); always false on the web.
nativeOnly
function nativeOnly<T>(fn: () => Promise<T>, fallback?: T): Promise<T | undefined>;
Run fn only inside the native shell; returns fallback on the web.
@kitr/mobile/provider
preferencesDriver
function preferencesDriver(): StorageDriver;
@capacitor/preferences as a kitr storage driver: hydrated at boot, written through in the background.
mobileProvider
const mobileProvider: import("@kitr/core").KitrProvider;
Runtime provider of the mobile platform. Inside the Capacitor shell it registers the
platform driver (App plugin: state, back button, deep links) and a storage driver on
Preferences, which survives the OS clearing WebView storage. In a plain browser it does nothing,
so the same bundle runs on the web. The shared shell behaviour (detection, registration,
devtools) is createShellProvider().