Skip to content

Kova on iOS

A Kova program can be an iPhone and iPad app. It runs in Xcode’s simulator on a Mac with an Apple chip, or on a real iPhone once you have signed it with your own Apple certificate (below).

Terminal window
$ kova build counter.kova --target ios-simulator
✓ counter.app (iOS Simulator, 180 KB) in 4.5 s

counter.app is a folder: your program and the small file that names it. Kova needs neither Xcode’s compiler nor Swift to make it. On the Mac, with Xcode installed:

Terminal window
$ xcrun simctl boot "iPhone 17"
$ xcrun simctl install booted counter.app
$ xcrun simctl launch --console-pty booted dev.kova.counter

The last word is the app’s name in lower case, after dev.kova.. --console-pty shows what the program prints.

A program with import ui keeps one file for the phone and the computer: see One program, every system.

In the programOn the iPhone
printthe console of simctl launch --console-pty
import uireal UIKit views: texts, buttons, fields, switches, sliders, choices, images, lists
a window’s column or rowa stack view, with its margins and styles

A window scrolls when it is taller than the screen, ui.canvas draws with Core Graphics and hears touches, dialogs are alerts and sound goes through AVAudioPlayer.

The window sits in a navigation bar: its title is the window’s, and each menu is a button of the bar opening its items (shortcuts are for a keyboard, which an iPhone has not). ui.tabs is a real tab bar. Programs are linked against iOS 26, so the system controls and both bars have the Liquid Glass look. A canvas wider than the screen scrolls sideways.

ui.gpu runs on OpenGL ES 3.0, which every iPhone has: your shaders keep #version 330 core, Kova gives them the header iOS wants. Apple has stopped improving OpenGL ES, and still runs it.

ui.open_file, ui.save_file and ui.open_folder open the system’s Files picker. A file you open is a copy in the app’s own folder; where you save is the place the user chose.

Apple only runs apps signed with a certificate it made for you. A free Apple ID is enough.

Add your Apple ID in Xcode once (Settings → Accounts), plug the iPhone in with Developer Mode on (Settings → Privacy & Security), then:

Terminal window
$ kova build counter.kova --target ios --run

Kova asks Xcode for the profile of dev.kova.counter (it makes one the first time), signs the app with your certificate from the keychain, installs it on the iPhone and starts it, showing what the program prints. Run it from a Terminal on the Mac: the first time, macOS asks to let codesign use your key (choose Always Allow). Without --run, you get the signed counter.app and install it yourself.

The iPhone may be on the same Wi-Fi instead of on a cable: in Xcode, Window → Devices and Simulators, select it once and tick Connect via network.

Kova signs by itself with a profile and an identity file, on Linux, Windows or Mac. What Apple needs, you do once, on a Mac:

  1. Plug the iPhone in, and turn on Settings → Privacy & Security → Developer Mode.
  2. In Xcode, add your Apple ID (Settings → Accounts) and make an empty iOS App project whose identifier is the one your program will have: dev.kova. and its name in lower case (a program with header { name := "essai" } is dev.kova.essai). Choose your account under Signing & Capabilities and run it once on the iPhone. Xcode makes the certificate and the profile.
  3. On the iPhone, trust yourself in Settings → General → VPN & Device Management.
  4. Give Kova the two things Xcode made. The profile is the .mobileprovision file in ~/Library/Developer/Xcode/UserData/Provisioning Profiles. The identity is your key and certificate as a PEM file, from the Keychain Access export (.p12):
Terminal window
$ openssl pkcs12 -legacy -in identity.p12 -nodes -out ios.pem

Then, on any computer:

Terminal window
$ kova build counter.kova --target ios --profile app.mobileprovision --identity ios.pem
✓ counter.app (iOS, 230 KB) in 6 s

Install it from a Mac with xcrun devicectl device install app --device <name> counter.app.

Kova checks that the profile allows the program’s name (dev.kova.counter) and has not expired. A free profile lasts 7 days: after that the app stops opening and you build it again with a new profile. A paid developer account (99 $ a year) lasts a year, and its profile may allow every name starting with dev.kova.. Keep ios.pem private: it is the key that signs your apps.

The simulator’s command line cannot touch the screen. For tests, KOVA_UI_TAP=0,0,1 makes the app tap its own buttons by number, one for each time the window is drawn:

Terminal window
$ SIMCTL_CHILD_KOVA_UI_TAP=0,0,1 xcrun simctl launch booted dev.kova.counter