iOS Embedding
The iOS host is a Swift package (BareHost) published from the repo root
Package.swift on every release tag. BareKit.xcframework comes with it as a
SwiftPM .binaryTarget (pinned by url + checksum), so a consumer adds one
package dependency and needs no prebuilds download or
FRAMEWORK_SEARCH_PATHS.
What you need
Section titled “What you need”- The
BareHostpackage at the exact ekrooh version you depend on (its products areBareHostandBareKit). - Your worklet bundle and built web assets, as app resources.
- The linked addons (udx-native, rocksdb-native, sodium-native, and
hypercore’s native deps) for p2p work, produced by
bare-link --preset iosand embedded in the app target.
project.yml (xcodegen)
Section titled “project.yml (xcodegen)”packages: BareHost: url: https://github.com/AndersCan/ekrooh exactVersion: X.Y.Ztargets: MyApp: dependencies: # Links both BareHost and BareKit; Xcode embeds BareKit through the # package. Do not embed a BareKit.xcframework yourself as well # ("Multiple commands produce .../BareKit.framework"). - package: BareHost # Every addon emitted by `bare-link --preset ios`, listed explicitly. - framework: addons/bare-fs.4.8.4.xcframework embed: trueIn Package.swift instead:
.package(url: "https://github.com/AndersCan/ekrooh", exact: "X.Y.Z"), then
.product(name: "BareHost", package: "ekrooh").
Host shell
Section titled “Host shell”BareHost ships the pieces that enforce the security model, so the app calls
them instead of re-implementing them (examples/ios-app/app/BareRuntime.swift
uses exactly these):
BareStorage.prepare()createsApplication Support/bare(durable, excluded from backup; it throws if the exclusion fails, and the host must not start) andCaches/bare-cache, deletes a stalehandoff.json, and moves aDocuments/bareleft by an older version (a failed move is retried next launch, and the leftover is excluded from backup meanwhile). Start the worklet with[webAssets, dirs.storage, dirs.cache].BareWebHost.configure(webView)turns link previews off and the view not inspectable.BareNavigationDelegateconfines the WebView to the loopback origin. Install it (webView.navigationDelegate = delegate) before any page loads. Off-origin links open in Safari only when the user activated them; an off-origintarget=_blankopens Safari, a same-origin one (orwindow.open) loads in place (BareNavigationDecision.loadInPlace); subframes are app-origin only.BareHandoff.consume(at: dirs.handoff)polls for the worklet’shandoff.json; it accepts only ahttp://127.0.0.1:<port>origin and a base64url nonce, and deletes the file as it reads it.BareWebHost.load(handoff, in: webView, delegate: delegate)confines the delegate to the handoff’s origin, adds an origin-guarded, main-frame onlyWKUserScriptat document start that setswindow.__ekrooh = { bootstrap }andwindow.BareShell, loads/index.html, and removes the script once that page has loaded.
Host plugins register on a HostPluginRegistry and are served by a
HostIpcCoordinator. A user-mediated handler (a picker, a permission prompt)
registers with timeout: HostPluginRegistry.userMediatedInvokeTimeout
(5 minutes); the default is 30 s. Timeouts are clamped to
HostPluginRegistry.maxInvokeTimeout (one day), and a non-positive or NaN
timeout is a precondition failure.
Build inputs (framework repo)
Section titled “Build inputs (framework repo)”npm run prebuilds # prebuilds/ios (hash-checked, no token)npm run build:ios # addons/, Resources/, web assets, ios-app.xcodeprojParity status
Section titled “Parity status”The iOS host has reference parity with Android: protocol, cookie auth,
navigation confinement, permissions, and a real picker/camera. Its public
Swift API is pinned by ios/public-api.swift.snap.