Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

iOS

Perry can cross-compile TypeScript apps for iOS devices and the iOS Simulator.

Requirements

  • macOS host (cross-compilation from Linux/Windows is not supported)
  • Xcode (full install, not just Command Line Tools) for iOS SDK and Simulator
  • Rust iOS targets:
    rustup target add aarch64-apple-ios aarch64-apple-ios-sim
    

Building for Simulator

perry app.ts -o app --target ios-simulator

This uses Cranelift cross-compilation with the iOS Simulator SDK. The binary can be run in the Xcode Simulator.

Building for Device

perry app.ts -o app --target ios

This produces an ARM64 binary for physical iOS devices. You’ll need to code sign and package it in an .app bundle for deployment.

UI Toolkit

Perry maps UI widgets to UIKit controls:

Perry WidgetUIKit Class
TextUILabel
ButtonUIButton (TouchUpInside)
TextFieldUITextField
SecureFieldUITextField (secureTextEntry)
ToggleUISwitch
SliderUISlider (Float32, cast at boundary)
PickerUIPickerView
ImageUIImageView
VStack/HStackUIStackView
ScrollViewUIScrollView

App Lifecycle

iOS apps use UIApplicationMain with a deferred creation pattern:

import { App, Text, VStack } from "perry/ui";

App("My iOS App", () =>
  VStack([
    Text("Hello, iPhone!"),
  ])
);

The App() call triggers UIApplicationMain, and your render function is called via PerryAppDelegate once the app is ready.

iOS Widgets (WidgetKit)

Perry can compile TypeScript widget declarations to native SwiftUI WidgetKit extensions:

perry widget.ts --target ios-widget

See Widgets (WidgetKit) for details.

Differences from macOS

  • No menu bar: iOS doesn’t support menu bars. Use toolbar or navigation patterns.
  • Touch events: onHover is not available. Use onClick (mapped to touch).
  • Slider precision: iOS UISlider uses Float32 internally (automatically converted).
  • File dialogs: Limited to UIDocumentPicker.
  • Keyboard shortcuts: Not applicable on iOS.

Next Steps