Siren
public final class Siren: NSObject
The Siren Class. A singleton that is initialized using the shared
constant.
-
The error domain for all errors created by Siren.
Declaration
Swift
public let SirenErrorDomain = "Siren Error Domain"
-
The SirenDelegate variable, which should be set if you’d like to be notified:
When a user views or interacts with the alert
- sirenDidShowUpdateDialog(alertType: AlertType)
- sirenUserDidLaunchAppStore()
- sirenUserDidSkipVersion()
- sirenUserDidCancel()
When a new version has been detected, and you would like to present a localized message in a custom UI. use this delegate method:
- sirenDidDetectNewVersionWithoutAlert(message: String)
Declaration
Swift
public weak var delegate: SirenDelegate?
-
The debug flag, which is disabled by default. When enabled, a stream of print() statements are logged to your console when a version check is performed.
Declaration
Swift
public lazy var debugEnabled = false
-
Determines the type of alert that should be shown. See the Siren.AlertType enum for full details.
Declaration
Swift
public var alertType: AlertType = .option
-
Determines the type of alert that should be shown for major version updates: A.b.c Defaults to Siren.AlertType.option. See the Siren.AlertType enum for full details.
Declaration
Swift
public lazy var majorUpdateAlertType: AlertType = .option
-
Determines the type of alert that should be shown for minor version updates: a.B.c Defaults to Siren.AlertType.option. See the Siren.AlertType enum for full details.
Declaration
Swift
public lazy var minorUpdateAlertType: AlertType = .option
-
Determines the type of alert that should be shown for minor patch updates: a.b.C Defaults to Siren.AlertType.option. See the Siren.AlertType enum for full details.
Declaration
Swift
public lazy var patchUpdateAlertType: AlertType = .option
-
Determines the type of alert that should be shown for revision updates: a.b.c.D Defaults to Siren.AlertType.option. See the Siren.AlertType enum for full details.
Declaration
Swift
public lazy var revisionUpdateAlertType: AlertType = .option
-
The name of your app. By default, it’s set to the name of the app that’s stored in your plist.
Declaration
Swift
public lazy var appName = Bundle.bestMatchingAppName()
-
The region or country of an App Store in which your app is available. By default, all version checks are performed against the US App Store. If your app is not available in the US App Store, set it to the identifier of at least one App Store within which it is available.
Declaration
Swift
public var countryCode: String?
-
Overrides the default localization of a user’s device when presenting the update message and button titles in the alert. See the Siren.LanguageType enum for more details.
Declaration
Swift
public var forceLanguageLocalization: Siren.LanguageType?
-
Overrides the tint color for UIAlertController.
Declaration
Swift
public var alertControllerTintColor: UIColor?
-
When this is set, the alert will only show up if the current version has already been released for X days Defaults to 1 day to avoid an issue where Apple updates the JSON faster than the app binary propogates to the App Store.
Declaration
Swift
public var showAlertAfterCurrentVersionHasBeenReleasedForDays: Int = 1
-
The current version of your app that is available for download on the App Store
Declaration
Swift
public internal(set) var currentAppStoreVersion: String?
-
The App’s Singleton
Declaration
Swift
public static let shared = Siren()
-
Checks the currently installed version of your app against the App Store. The default check is against the US App Store, but if your app is not listed in the US, you should set the
countryCode
property before calling this method. Please refer to the countryCode property for more information.Declaration
Swift
public func checkVersion(checkType: VersionCheckType)
Parameters
checkType
The frequency in days in which you want a check to be performed. Please refer to the Siren.VersionCheckType enum for more details.
-
Launches the AppStore in two situations:
- User clicked the
Update
button in the UIAlertController modal. - Developer built a custom alert modal and needs to be able to call this function when the user chooses to update the app in the aforementioned custom modal.
Declaration
Swift
public func launchAppStore()
- User clicked the
-
Determines the type of alert to present after a successful version check has been performed.
See moreDeclaration
Swift
enum AlertType
-
Determines the frequency in which the the version check is performed and the user is prompted to update the app.
See moreDeclaration
Swift
enum VersionCheckType: Int
-
Determines the available languages in which the update message and alert button titles should appear.
By default, the operating system’s default lanuage setting is used. However, you can force a specific language by setting the forceLanguageLocalization property before calling checkVersion()
See moreDeclaration
Swift
enum LanguageType: String