AirshipUtils
public final class AirshipUtils
The Utils object provides an interface for utility methods.
-
Get the device model name (e.g.,
iPhone3,1).Declaration
Swift
public class func deviceModelName() -> String?Return Value
The device model name.
-
Gets the short bundle version string.
Declaration
Swift
public class func bundleShortVersionString() -> String?Return Value
A short bundle version string value.
-
Checks if the device has network connection.
Declaration
Swift
public class func hasNetworkConnection() -> BoolReturn Value
The true if it has connection, false otherwise.
-
Compares two version strings and determines their order.
Declaration
Swift
public class func compareVersion( _ fromVersion: String, toVersion: String, maxVersionParts: Int? = nil ) -> ComparisonResultParameters
fromVersionThe first version.
toVersionThe second version.
maxVersionPartsMax number of version parts to compare. Use 3 to only compare major.minor.patch
Return Value
a
ComparisonResult.
-
Returns the main window for the app.
This window will be positioned underneath any other windows added and removed at runtime, by classes such a
UIAlertVieworUIActionSheet.Declaration
Swift
@MainActor public class func mainWindow() throws -> UIWindow?Return Value
The main window, or
nilif the window cannot be found. -
Returns the main window for the given
UIWindowScene.This window will be positioned underneath any other windows added and removed at runtime, by classes such a
UIAlertVieworUIActionSheet.Declaration
Swift
@MainActor public class func mainWindow(scene: UIWindowScene) -> UIWindow?Parameters
sceneThe
UIWindowScene.Return Value
The main window, or
nilif the window cannot be found.
-
Takes an array of fetch results and returns the merged result.
Declaration
Swift
public class func mergeFetchResults( _ results: [UInt] ) -> UIBackgroundFetchResultParameters
resultsAn
Arrayof fetch results.Return Value
The merged fetch result.
-
Takes an array of fetch results and returns the merged result.
-
Determine if the notification payload is a silent push (no notification elements).
Declaration
Swift
public class func isSilentPush(_ notification: [AnyHashable : Any]) -> BoolReturn Value
truethe notification is a silent push,falseotherwise. -
Determine if the notification payload is an alerting push.
Declaration
Swift
public class func isAlertingPush(_ notification: [AnyHashable : Any]) -> BoolReturn Value
truethe notification is an alerting push,falseotherwise.
-
Takes an APNS-provided device token and returns the decoded Airship device token.
Declaration
Swift
public class func deviceTokenStringFromDeviceToken(_ token: Data) -> StringParameters
tokenAn APNS-provided device token.
Return Value
The decoded Airship device token.
-
Generates a
SHA256digest for the input string.Declaration
Swift
public class func sha256Digest(input: String) -> NSDataParameters
inputStringfor which to calculate SHA.Return Value
The
SHA256digest asNSData. -
Generates a
SHA256hash for the input string.Declaration
Swift
public class func sha256Hash(input: String) -> StringParameters
inputInput string for which to calculate SHA.
Return Value
SHA256 digest as a hex string
-
Returns a basic auth header string.
Declaration
Swift
public class func authHeader(username: String, password: String) -> String?Parameters
usernameThe username.
passwordThe password.
Return Value
An HTTP Basic Auth header string value for the provided credentials in the form of:
Basic [Base64 Encoded "username:password"]
-
Parse url for the input string.
Declaration
Swift
public class func parseURL(_ value: String) -> URL?Parameters
valueInput string for which to create the URL.
Return Value
returns the created URL otherwise return nil.
View on GitHub