iOS
The iOS host is a Swift package (BareHost) that ships as a git-fetchable
package from the repo root Package.swift, so consumers add it as a normal
SPM dependency at an exact ekrooh tag. The runtime binary (BareKit.xcframework)
is bundled as a .binaryTarget resolved through the same tag — no sibling
checkout, no cross-repo npm step.
Public surface
Section titled “Public surface”BareProtocol— Swift mirror of the binary wire protocol (buildErrorResponse(…type:)).HostIpcCoordinator/HostIpcRouter— IPC frames; delegates host plugins. Malformed fields (empty, non-string, over 256 bytes) and unreadable headers are answeredFRAME_INVALID; a non-JSON handler result isINVALID_RESPONSE; an oversized oneFRAME_TOO_LARGE.HostPluginRegistry— plugin ID → handler map, with a per-handlertimeout(defaultInvokeTimeout30 s,userMediatedInvokeTimeout5 min, clamped tomaxInvokeTimeout1 day;invokeTimeout(pluginId:event:)). A non-positive or NaN timeout traps (precondition).BareStorage/BareStorageDirectories/BareStorageError— worklet directories in Application Support (excluded from backup) and Caches.BareHandoff— parses and deleteshandoff.json; builds the bootstrap user script.BareNavigationPolicy/BareNavigationDecision(allow,cancel,openExternally,loadInPlacefor a same-origin new window) /BareNavigationDelegate— loopback-origin confinement.BareWebHost—configure(_:)(WebView hardening) andload(_:in:delegate:)(bootstrap injection + first load).BareHostLogger— unified logger (subsystem: "to.holepunch.bare.ios").
The public Swift API is pinned by ios/public-api.swift.snap
(security.apple.test.ts); after an intended, reviewed change regenerate it
with vp test security.apple.test.ts -u. See
iOS Embedding for how a shell uses these.
Dependencies
Section titled “Dependencies”BareKit— vendoredWorklet/IPCbridge (Sources/BareKit+Sources/BareKitBridge, fromholepunchto/bare-kit-swift, Apache-2.0).BareKit.xcframework— the runtime binary, bundled as a SwiftPM.binaryTargetresolved from the release tag artifact. Vendoring the bridge (rather than depending on the upstream git package) is what lets it resolve<BareKit/BareKit.h>with no consumerFRAMEWORK_SEARCH_PATHS.- P2P addons (udx-native, rocksdb-native, sodium-native, + hypercore’s
native deps) linked via
bare-linkand verified on the simulator.
Consuming
Section titled “Consuming”.package(url: "https://github.com/AndersCan/ekrooh", exact: "X.Y.Z")// targets:.product(name: "BareHost", package: "ekrooh").product(name: "BareKit", package: "ekrooh")Xcode embeds BareKit through the package product; do not embed the
prebuild a second time. An app target must still embed the
bare-link --preset ios addon frameworks. See ios/readme.md for the full
contract.
Reference app
Section titled “Reference app”examples/ios-app runs the same web assets with the library’s storage,
handoff and navigation pieces; the reference host wires a real
picker/camera (PHPickerViewController + UIImagePickerController) and real
permissions (AVCaptureDevice.requestAccess).
npm run prebuilds # prebuilds/ios/BareKit.xcframeworknpm run build:ios # addons/, Resources/, ios-app.xcodeprojnpm run test:ios # XCTest + UI test on the simulatorTests: Tests/BareHostTests/ (XCTest mirroring the JUnit suite) + a UI test
against the reference app.