Expand description
bevy_ios_toolkit — native iOS integrations for Bevy, as ordinary ECS
resources and messages.
Each integration is a cargo feature and a module:
| feature | module | what it bridges |
|---|---|---|
storekit | store | StoreKit 2 in-app purchases |
ads | ads | Google AdMob ads + UMP consent |
att | att | App Tracking Transparency prompt |
gamekit | gamekit | Game Center auth, leaderboards, achievements |
review | review | StoreKit review prompt |
platform | platform | haptics, safe-area inset, outbound links |
No feature is on by default. Enable exactly what you ship — a module’s
extern "C" block only exists when its feature is on, and the matching Swift
shim must be in your Xcode target or iOS linking fails on undefined symbols.
bevy_ios_toolkit = { version = "0.1", features = ["storekit", "ads", "att"] }§The native contract
Shared across every module (see [ffi]):
- Every native entry point is
@_cdeclC-ABI, called from Rust. - Async, delegate-driven SDK work surfaces as polled state (or a drained event queue) read once per frame — never callbacks into Rust, because re-entrancy against winit’s event loop is not safe.
- Each Swift shim sits behind
#if canImport(...)with linking stubs, so the staticlib links on any target.
Off iOS every module is a stateful, env-tunable fake, so the whole app
flow is exercisable on cargo run desktop builds with no device.
use bevy::prelude::*;
use bevy_ios_toolkit::prelude::*;
fn main() {
App::new()
.add_plugins((MinimalPlugins, IosPlugin))
.run();
}Modules§
- ads
- Google AdMob ads as Bevy resources + messages.
- att
- App Tracking Transparency (ATT) as Bevy resources + messages.
- gamekit
- Game Center (GameKit) as Bevy resources + messages: authentication, leaderboard score submission, and achievement reporting.
- platform
- Apple-platform niceties: impact
haptics, the topsafe_areainset, and opening outboundlinks. Thin, fire-and-forget wrappers overswift/CupertinoPlatform.swift; no-ops off iOS (links shell out toopenon macOS so the flow is debuggable on desktop). - prelude
- review
- Ask for an App Store rating via
SKStoreReviewController/AppStore. - store
- StoreKit 2 in-app purchases as Bevy resources + messages.
Structs§
- IosPlugin
- Installs every enabled iOS integration. Composition is feature-driven: a module only wires its systems when its feature is on.