AirshipUtils
@objc(UAUtils)
public class AirshipUtils : NSObject
The Utils
object provides an interface for utility methods.
-
Get the device model name (e.g.,
iPhone3,1
).Declaration
Swift
@objc public class func deviceModelName() -> String?
Return Value
The device model name.
-
Gets the short bundle version string.
Declaration
Swift
@objc public class func bundleShortVersionString() -> String?
Return Value
A short bundle version string value.
-
Gets the current carrier name.
Declaration
Swift
@objc public class func carrierName() -> String?
Return Value
The current carrier name.
-
Gets the current connection type.
Declaration
Swift
@objc public class func connectionType() -> String
Return Value
The current connection type as a
String
. -
Compares two version strings and determines their order.
Declaration
Swift
@objc(compareVersion:toVersion:) public class func compareVersion(_ fromVersion: String, toVersion: String) -> ComparisonResult
Parameters
fromVersion
The first version.
toVersion
The second version.
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
UIAlertView
orUIActionSheet
.Declaration
Swift
@MainActor public class func mainWindow() throws -> UIWindow?
Return Value
The main window, or
nil
if 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
UIAlertView
orUIActionSheet
.Declaration
Swift
@available(iOS 13.0, tvOS 13.0, *) @objc(mainWindow:) @MainActor public class func mainWindow(scene: UIWindowScene) -> UIWindow?
Parameters
scene
The
UIWindowScene
.Return Value
The main window, or
nil
if the window cannot be found.
-
Takes an array of fetch results and returns the merged result.
Declaration
Swift
@objc public class func mergeFetchResults( _ results: [UInt] ) -> UIBackgroundFetchResult
Parameters
results
An
Array
of 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
@objc public class func isSilentPush(_ notification: [AnyHashable : Any]) -> Bool
Return Value
true
the notification is a silent push,false
otherwise. -
Determine if the notification payload is an alerting push.
Declaration
Swift
@objc public class func isAlertingPush(_ notification: [AnyHashable : Any]) -> Bool
Return Value
true
the notification is an alerting push,false
otherwise.
-
Takes an APNS-provided device token and returns the decoded Airship device token.
Declaration
Swift
@objc public class func deviceTokenStringFromDeviceToken(_ token: Data) -> String
Parameters
token
An APNS-provided device token.
Return Value
The decoded Airship device token.
-
Generates a
SHA256
digest for the input string.Declaration
Swift
@objc(sha256DigestWithString:) public class func sha256Digest(input: String) -> NSData
Parameters
input
String
for which to calculate SHA.Return Value
The
SHA256
digest asNSData
. -
Generates a
SHA256
hash for the input string.Declaration
Swift
@objc(sha256HashWithString:) public class func sha256Hash(input: String) -> String
Parameters
input
Input string for which to calculate SHA.
Return Value
SHA256 digest as a hex string
-
Returns a basic auth header string.
Declaration
Swift
@objc(authHeaderStringWithName:password:) public class func authHeader(username: String, password: String) -> String?
Parameters
username
The username.
password
The 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
@objc(parseURL:) public class func parseURL(_ value: String) -> URL?
Parameters
value
Input string for which to create the URL.
Return Value
returns the created URL otherwise return nil.