On iOS and macOS, load an .egg with EggPlayer(data:), start a state machine, and show it with EggView(player:) in SwiftUI. Set inputs with setBool, setNumber and fire, and view model properties from your Swift code. The package also has a Metal-backed view and an audio helper for sound events.
- Platform
- iOS and macOS
- Binding
- Swift package (EggRuntime)
- Draws with
- Core Graphics image, or Metal
- Same file everywhere
- One .egg plays the same on every runtime
- License
- MIT or Apache-2.0
In SwiftUI
import SwiftUI
import EggRuntime
struct HatchView: View {
let player: EggPlayer
init() throws {
let url = Bundle.main.url(forResource: "hatch", withExtension: "egg")!
player = try EggPlayer(data: Data(contentsOf: url))
player.startStateMachine("hatch")
}
var body: some View {
VStack {
EggView(player: player) // taps and drags reach the file's listeners
Button("Hatch") { player.fire("tap") }
}
}
}EggView forwards touches to the state machine's pointer listeners, so most files need no extra code; your own controls fire inputs directly.
Last checked against the product on 2026-10-15.



