tauri-plugin-plauth 1.0.4

Tauri plugin for authentication (PLAUTH) supporting macOS and iOS platforms with ASWebAuthenticationSession
Documentation
const COMMANDS: &[&str] = &["ping", "authenticate"];

fn main() {
    // Only run this build script when building the plugin itself
    if std::env::var("CARGO_PKG_NAME").unwrap_or_default() != "tauri-plugin-plauth" {
        println!("Not building plugin");
        return;
    }

    println!("Building plugin with commands: {:?}", COMMANDS);

    // Build the main plugin
    tauri_plugin::Builder::new(COMMANDS)
        .android_path("android")
        .ios_path("ios")
        .build();

    // Handle macOS Swift linking only when building for macOS target
    #[cfg(target_os = "macos")]
    {
        if std::env::var("CARGO_CFG_TARGET_OS").map(|v| v == "macos").unwrap_or(false) {
            println!("Building plugin for macOS");

            // Use swift-rs to link Swift code
            swift_rs::SwiftLinker::new("13.0")
                .with_package("tauri-plugin-plauth", "./macos/")
                .link();
        }
    }
}