Contracts for integrating Eitri iOS modules with the Eitri Machine runtime. The package defines lightweight Swift protocols and value types that standardise how native modules report their capabilities, expose callable methods, and gain access to runtime context supplied by the Eitri SDK.
- Swift 5.9 or later
- Xcode 15 or later (for local development and testing)
- iOS 13.0 minimum deployment target
-
EitriModule: Adopt this protocol in every native module exposed to the Eitri runtime. The runtime callsstart(contextProvider:), and the module must synchronously finish registering the methods it intends to expose. Defer long-running work; blockingstartwill stall host bootstrapping. -
EitriContextProvider: A runtime bridge returned to modules duringstart. Use it to read the immutableAppContextand to register asynchronous handlers viaexposeMethod(named:method:). -
AppContext: Immutable metadata about the host environment (SDK version, debug flag, bundle identifier). Treat it as read-only state that describes the runtime, not the business payload. -
ModuleExposedMethod: Type alias for asynchronous handlers. Handlers receiveModuleMethodParamsand may return any JSON-serialisable result. Throwing propagates a failure back to the caller. -
ModuleMethodParams: Invocation payload containing structureddata, theEitriAppInvokingMethoddescriptor for the requesting app, and thecurrentViewControlleravailable to present UI.
The runtime also exposes an EitriModuleRegistry protocol that host applications implement to accept
modules. Modules should never retain the registry; use it only at initial registration time.
Sources/EitriContracts: Protocols and value types that define the native contract surface.Tests/EitriContractsTests: Integration-style coverage that exercises a fake registry and module.