Siren Documentation

repository·master·Indexed 26 days ago

https://github.com/artsabintsev/siren

A Swift library for iOS and tvOS that checks the installed app version against the App Store. It provides customizable, localized alerts for forced, optional, or skipped updates via the Rules.AlertType enum.

Tokens
715
Snippets
3
Records
6
Agent score
38%

What's inside Siren

  1. Integrate Siren into your app

    master

    To start checking for updates, import Siren and call Siren.shared.wail() in your app's entry point. You can place this in either AppDelegate.swift or SceneDelegate.swift.

    import Siren // Line 1
    import UIKit
    
    @UIApplicationMain
    class AppDelegate: UIResponder, UIApplicationDelegate {
        var window: UIWindow?
    
        func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
            window?.makeKeyAndVisible()
    
            Siren.shared.wail() // Line 2
    
            return true
        }
    }
  2. Test Siren locally

    master

    To verify Siren is working in your development environment:

    1. Temporarily change your app's version string in Xcode (within the .xcodeproj file) to an older version than what is currently in the App Store.
    2. Build and run your app; the update alert should appear.

    Alternatively, if your app is not yet in the store, change your bundleID to an existing app's ID (e.g., Facebook's com.facebook.Facebook) to trigger the check.

  3. Force a specific language for update alerts

    master

    By default, Siren uses the user's device locale. To override this and force the update dialog to appear in a specific language, assign a new PresentationManager to Siren.shared.presentationManager with the forceLanguageLocalization parameter.

    // In this example, we force the `Russian` language.
    Siren.shared.presentationManager = PresentationManager(forceLanguageLocalization: .russian)
  4. Configure Alert Types via Rules.AlertType

    master

    Siren provides three types of update alerts controlled by the Rules.AlertType enum:

    • Forced Update: Forces the user to update the app.
    • Optional Update: Gives the user the option to update.
    • Skipped Update: Gives the user the option to skip the current update.
  5. Configure the delay before prompting for updates

    master
    To account for delays between iTunes JSON updates and App Store CDN availability, Siren defaults to waiting 1 day (24 hours) after a new version is detected before prompting the user. You can adjust this delay by modifying the showAlertAfterCurrentVersionHasBeenReleasedForDays property.