9.0 Released! → Native ESM runtimes 🚀, Vite support ⚡️, multi-window apps and more...
Read Announcement
ts
const iOSNativeHelper: {
  animateWithSpring: (options?: {
     animateOptions?: UIViewAnimationOptions;
     animations?: () => void;
     completion?: (finished?: boolean) => void;
     delay?: number;
     friction?: number;
     mass?: number;
     tension?: number;
     velocity?: number;
  }) => void;
  applyRotateTransform: (transform: CATransform3D, x: number, y: number, z: number) => CATransform3D;
  collections: {
     jsArrayToNSArray: NSArray<T>;
     nsArrayToJSArray: T[];
  };
  copyLayerProperties: (view: UIView, toView: UIView, customProperties?: {
     layer?: (string | number | symbol)[];
     view?: (string | number | symbol)[];
  }) => void;
  createUIDocumentInteractionControllerDelegate: () => NSObject;
  getCurrentAppPath: () => string;
  getMainScreen: () => UIScreen;
  getRootViewController: () => UIViewController;
  getVisibleViewController: (rootViewController: UIViewController) => UIViewController;
  getWindow: () => UIWindow;
  isLandscape: () => boolean;
  joinPaths: (...paths: string[]) => string;
  MajorVersion: number;
  printCGRect: (rect: CGRect) => void;
  setWindowBackgroundColor: (value: string) => void;
  snapshotView: (view: UIView, scale: number) => UIImage;
} = ios;

Defined in: utils/native-helper.d.ts:285

Type Declaration

animateWithSpring

ts
animateWithSpring: (options?: {
  animateOptions?: UIViewAnimationOptions;
  animations?: () => void;
  completion?: (finished?: boolean) => void;
  delay?: number;
  friction?: number;
  mass?: number;
  tension?: number;
  velocity?: number;
}) => void;

Animate views with a configurable spring effect

Parameters

ParameterTypeDescription
options?{ animateOptions?: UIViewAnimationOptions; animations?: () => void; completion?: (finished?: boolean) => void; delay?: number; friction?: number; mass?: number; tension?: number; velocity?: number; }various animation settings for the spring - tension: number - friction: number - mass: number - delay: number - velocity: number - animateOptions: UIViewAnimationOptions - animations: () => void, Callback containing the property changes you want animated - completion: (finished: boolean) => void, Callback when animation is finished
options.animateOptions?UIViewAnimationOptions-
options.animations?() => void-
options.completion?(finished?: boolean) => void-
options.delay?number-
options.friction?number-
options.mass?number-
options.tension?number-
options.velocity?number-

Returns

void

applyRotateTransform

ts
applyRotateTransform: (transform: CATransform3D, x: number, y: number, z: number) => CATransform3D;

Applies a rotation transform over X,Y and Z axis

Parameters

ParameterTypeDescription
transformCATransform3DApplies a rotation transform over X,Y and Z axis
xnumberRotation over X axis in degrees
ynumberRotation over Y axis in degrees
znumberRotation over Z axis in degrees

Returns

CATransform3D

collections

ts
collections: {
  jsArrayToNSArray: NSArray<T>;
  nsArrayToJSArray: T[];
};

Utilities related to iOS collections.

collections.jsArrayToNSArray()

ts
jsArrayToNSArray<T>(str: T[]): NSArray<T>;

Converts JavaScript array to NSArray.

Type Parameters
Type Parameter
T
Parameters
ParameterTypeDescription
strT[]JavaScript string array to convert.
Returns

NSArray<T>

collections.nsArrayToJSArray()

ts
nsArrayToJSArray<T>(a: NSArray<T>): T[];

Converts NSArray to JavaScript array.

Type Parameters
Type Parameter
T
Parameters
ParameterTypeDescription
aNSArray<T>NSArray to convert.
Returns

T[]

copyLayerProperties

ts
copyLayerProperties: (view: UIView, toView: UIView, customProperties?: {
  layer?: (string | number | symbol)[];
  view?: (string | number | symbol)[];
}) => void;

Copy layer properties from one view to another.

Parameters

ParameterTypeDescription
viewUIViewa view to copy layer properties to
toViewUIViewa view to copy later properties from
customProperties?{ layer?: (string | number | symbol)[]; view?: (string | number | symbol)[]; }-
customProperties.layer?(string | number | symbol)[]-
customProperties.view?(string | number | symbol)[]-

Returns

void

createUIDocumentInteractionControllerDelegate

ts
createUIDocumentInteractionControllerDelegate: () => NSObject;

Create a UIDocumentInteractionControllerDelegate implementation for use with UIDocumentInteractionController

Returns

NSObject

getCurrentAppPath

ts
getCurrentAppPath: () => string;

Gets the root folder for the current application. This Folder is private for the application and not accessible from Users/External apps. iOS - this folder is read-only and contains the app and all its resources.

Returns

string

getMainScreen

ts
getMainScreen: () => UIScreen;

Returns

UIScreen

getRootViewController

ts
getRootViewController: () => UIViewController;

Get the root UIViewController of the app

Returns

UIViewController

getVisibleViewController

ts
getVisibleViewController: (rootViewController: UIViewController) => UIViewController;

Gets the currently visible(topmost) UIViewController.

Parameters

ParameterTypeDescription
rootViewControllerUIViewControllerThe root UIViewController instance to start searching from (normally window.rootViewController). Returns the visible UIViewController.

Returns

UIViewController

getWindow

ts
getWindow: () => UIWindow;

Returns

UIWindow

application window.

Deprecated

Use Utils.getWindow<UIWindow>() instead.

isLandscape

ts
isLandscape: () => boolean;

Returns

boolean

Deprecated

use Application.orientation instead

Gets an information about if current mode is Landscape.

joinPaths

ts
joinPaths: (...paths: string[]) => string;

Joins an array of file paths.

Parameters

ParameterTypeDescription
...pathsstring[]An array of paths. Returns the joined path.

Returns

string

MajorVersion

ts
MajorVersion: number;

Deprecated

use Utils.SDK_VERSION instead which is a float of the {major}.{minor} verison

printCGRect

ts
printCGRect: (rect: CGRect) => void;

Debug utility to insert CGRect values into logging output. Note: when printing a CGRect directly it will print blank so this helps show the values.

Parameters

ParameterTypeDescription
rectCGRectCGRect

Returns

void

setWindowBackgroundColor

ts
setWindowBackgroundColor: (value: string) => void;

Set the window background color of base view of the app. Often this is the view shown behind opening a modal, eg: a modal scales down revealing the window color.

Parameters

ParameterTypeDescription
valuestringcolor (hex, rgb, rgba, etc.)

Returns

void

snapshotView

ts
snapshotView: (view: UIView, scale: number) => UIImage;

Take a snapshot of a View on screen.

Parameters

ParameterTypeDescription
viewUIViewview to snapshot
scalenumberscreen scale

Returns

UIImage

Deprecated

use Utils.ios instead.

Previous
ios