NativeObjCBridge
The iOS bridge to the Objective-C runtime, scoped to the plugin's capabilities.
type NativeObjCBridge = { … }Members
(classOrName: string | NativeHandle): NativeHandleAllocates an instance and initializes it with init, UIKit classes on the main thread; use create for any other initializer.
(handle: NativeHandle): NativeObjCResult[]Converts an NSArray handle to a JavaScript array.
(steps: readonly NativeBatchStep[]): NativeCancelablePromise<NativeObjCResult[]>Runs dependent calls in one main-thread pass; a failed step rejects it without undoing earlier steps.
(handle: NativeHandle, selector: string, ...args: unknown[]): NativeObjCResultSends a selector with its arguments on the current runtime thread.
(handle: NativeHandle, currentClass: string | NativeHandle, selector: string, ...args: unknown[]): NativeObjCResultRuns the implementation currentClass's superclass provides, like super in Objective-C.
(handle: NativeHandle): string | nullReturns the class name of the object a handle refers to, or null.
(classOrName: string | NativeHandle, initSelector: string, args?: unknown[], options?: NativeCallOptions): NativeHandleAllocates an uninitialized instance, UIKit classes on the main thread unless options.thread says otherwise, and returns what initSelector initializes; throws when that is nil.
Creates a key for attaching a value to objects with setAssociatedObject.
(value: ArrayBuffer | Uint8Array<ArrayBufferLike>): NativeHandleCopies bytes into a new NSData object.
(plan: NativeObjCCallPlan): voidFrees a call plan; using it afterwards throws.
(root: NativeHandle, className: string, options?: NativeViewSearchOptions): NativeCancelablePromise<NativeHandle[]>Finds the views of a class under or above a view on the main thread. Needs native.objc.snapshot.
(handle: NativeHandle, key: NativeHandle): NativeObjCResultReads the value attached to an object under a key.
(name: string): NativeHandle | nullLooks up a class by name, or returns null when none is registered.
(handle: NativeHandle, name: string): NativeObjCResultReads an instance variable by name, such as _viewModel.
<Receiver extends boolean = true>(className: string, selector: string, handlers: NativeHookHandlers<Receiver>, options?: NativeHookOptions<Receiver>): NativeHookTokenHooks a method by class and selector; handlers run in registration order, and the scope removes the hook on dispose.
(handle: NativeHandle, selector: string, args: unknown[], options?: NativeCallOptions): NativeObjCResultSends a selector on the thread options.thread names; main blocks, main-post queues void methods, so prefer invokeAsync or main-post for UI work. Ownership follows Cocoa naming: an alloc, new, copy, mutableCopy or init result is owned by its handle without an extra reference, and the receiver of an init selector stays valid.
(handle: NativeHandle, selector: string, args: unknown[]): NativeCancelablePromise<NativeObjCResult>Sends a selector on the main thread and resolves with its result. Needs native.objc.invokeAsync.
(plan: NativeObjCCallPlan, handle: NativeHandle, args: unknown[], options?: NativeCallOptions): NativeObjCResultCalls a prepared selector on an object, on the thread options.thread names, like invoke.
(plan: NativeObjCCallPlan, handle: NativeHandle, args: unknown[]): NativeCancelablePromise<NativeObjCResult>Calls a prepared selector on the main thread and resolves with its result, like invokeAsync.
(handle: NativeHandle, currentClass: string | NativeHandle, selector: string, args: unknown[], options?: NativeCallOptions): NativeObjCResultLike callSuper with a thread policy; it cannot cross to the main thread synchronously.
(handle: NativeHandle, currentClass: string | NativeHandle, selector: string, args: unknown[]): NativeCancelablePromise<NativeObjCResult>Runs the superclass implementation on the main thread and resolves with its result.
(handle: NativeHandle, selector: string): NativeObjCCallPlanResolves a selector's method signature on an object once, for repeated calls through invokePrepared.
(handle: NativeHandle, selector: string): booleanChecks whether the object responds to a selector.
(handle: NativeHandle, key: NativeHandle, value: NativeObjCResult, policy?: string): voidAttaches a value to an object; null clears it. policy is assign, retain, copy, retainNonatomic or copyNonatomic.
(handle: NativeHandle, name: string, value: NativeObjCResult): voidWrites an instance variable by name.
(root: NativeHandle, options?: NativeViewSnapshotOptions): NativeCancelablePromise<NativeViewSnapshotNode[]>Reads a UIView subtree in one main-thread pass, as a point-in-time list. Needs native.objc.snapshot.
<T extends NativeStructFields = NativeStructFields>(name: string, fields: T): NativeStruct<T>Builds a registered struct, such as CGRect or UIEdgeInsets, to pass to native calls.