#bevy-plugin #ios #bevy #mobile #swift #gamedev

bevy_ios_alerts

Bevy plugin to request ios native UIAlert popups

6 releases

new 0.3.0 Dec 2, 2024
0.2.0 Jul 10, 2024
0.1.3 May 11, 2024
0.1.2 Apr 17, 2024

#1170 in Game dev

Download history 15/week @ 2024-08-25 63/week @ 2024-09-01 162/week @ 2024-09-08 42/week @ 2024-09-15 25/week @ 2024-09-22 50/week @ 2024-09-29 65/week @ 2024-10-06 46/week @ 2024-10-13 17/week @ 2024-10-20 38/week @ 2024-10-27 47/week @ 2024-11-03 49/week @ 2024-11-10 46/week @ 2024-11-17 29/week @ 2024-11-24 144/week @ 2024-12-01

271 downloads per month

MIT license

12KB
192 lines

bevy_ios_alerts

crates.io docs.rs discord

Rust crate and Swift package to easily integrate iOS's native UIAlerts API into a Bevy application.

demo

demo from our game using this crate: zoolitaire.com

See also bevy_ios_iap, bevy_ios_notifications, bevy_ios_gamecenter, bevy_ios_review & bevy_ios_impact

Instructions

  1. Add to XCode: Add SPM (Swift Package Manager) dependency
  2. Add Rust dependency
  3. Setup Plugin

1. Add to XCode

Go to File -> Add Package Dependencies and paste https://github.com/rustunit/bevy_ios_alerts.git into the search bar on the top right: xcode

2. Add Rust dependency

cargo add bevy_ios_alerts

or

bevy_ios_alerts = { version = "0.2" }

3. Setup Plugin

Initialize Bevy Plugin:

app.add_plugins(bevy_ios_alerts::IosAlertsPlugin);

Trigger Alert in your application code:

fn system_triggerin_alerts(mut events: EventWriter<IosAlert>) {
     
    events.send(IosAlert::Message {
        title: String::from("title"),
        msg: String::from("msg"),
        button: String::from("ok"),
    });
     
    events.send(IosAlert::Dialog {
        title: String::from("title"),
        msg: String::from("this is a dialog with multiple buttons"),
        button_yes: String::from("absolutely yes"),
        button_no: String::from("no no no"),
    });
                    
    events.send(IosAlert::Input {
        title: String::from("title"),
        msg: String::from("input box"),
        button: String::from("ok"),
        placeholder: String::from("placeholder"),
    });
}

fn process_alert_response(mut events: EventReader<IosAlertResponse>) {
    for e in events.read() {
        info!("incoming alert response: {e:?}");
    }
}

Our Other Crates

Bevy version support

bevy bevy_ios_alerts
0.14 0.3,main
0.14 0.2
0.13 0.1

License

All code in this repository is dual-licensed under either:

at your option. This means you can select the license you prefer.

Your contributions

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~22–33MB
~528K SLoC