uikit
Typed UIKit bindings for building native iOS apps, the sibling of
appkit on the desktop. Like appkit, it is ObjC-runtime
FFI: real UIView objects, closure-free callbacks, and owned wrappers that
release in drop. Build it for the iOS targets with --target ios-arm64 (see
Targets & cross-compilation).
The umbrella uikit module re-exports a full surface, organized like appkit's:
- Core —
Window,ViewController,View,Label,Color,Screen, and app-delegate synthesis. - Controls —
Button,Slider,Switch,SegmentedControl,ProgressView,ActivityIndicator,PageControl,DatePicker. - Text —
TextField,SecureTextField,TextView,SearchBar. - Containers & data — stack/scroll containers,
TableView,CollectionView,PickerView. - Graphics —
ImageView,Image,Font,BezierPath, and custom-view synthesis (drawRect:). - Navigation & chrome —
AlertController, toolbar, navigation / tab / split / page controllers, the pasteboard, Auto Layout anchors, events, and notifications.
Entry point and build
iOS apps enter through UIKit, so a C+ app exports cplus_app_main and the Xcode
target keeps a two-line C main shim that calls it; the C+ side registers the
app delegate and enters UIApplicationMain:
extern int cplus_app_main(int, char **);
int main(int argc, char **argv) { return cplus_app_main(argc, argv); }
cpc build --target ios-arm64 emits a staticlib (object + archive + C header);
Xcode owns the final link, exactly as described on the
targets page. A C+-driven screen (a white window with a centered
label) has rendered on the iPhone 16 Pro simulator. For the Objective-C
message-send mechanics underneath, see FFI.