Skip to main content

Crate bevy_ios_toolkit

Crate bevy_ios_toolkit 

Source
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:

featuremodulewhat it bridges
storekitstoreStoreKit environment + in-app purchases (iOS only)
adsadsGoogle AdMob ads + UMP consent
attattApp Tracking Transparency prompt
gamekitgamekitGame Center auth, leaderboards, achievements
reviewreviewStoreKit review prompt
platformplatformhaptics, safe-area insets, links, share sheet, thermal/low-power state, boot shield, audio session

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.

[dependencies]
bevy_ios_toolkit = { version = "0.4", features = ["ads", "att"] }

[target.'cfg(target_os = "ios")'.dependencies]
bevy_ios_toolkit = { version = "0.4", features = ["storekit"] }

§The native contract

Shared across every native module:

  • Every native entry point is @_cdecl C-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, integrations keep a fake only where a real cross-platform flow benefits from one. StoreKit purchases are platform-owned: store is iOS only and has no desktop backend.

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 integrations — thin wrappers over the Platform Swift shim (one .swift file per concern under Sources/Platform/), no-ops off iOS.
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.