ReachabilityConfiguration
public struct ReachabilityConfiguration
ReachabilityConfiguration class, allowing for custom Reachability parameters
-
Default timeout for server authorization check
Declaration
Swift
public static let defaultTimeout: TimeInterval = 120.0 -
Default length of time to cache server authorization check results
Declaration
Swift
public static let defaultCacheLength: TimeInterval = 1.0 -
The URL used to perform the server authorization check
Declaration
Swift
public var authorizationURL: URL? -
The Http.StatusCode expected to be returned when calling the
authorizationURL, when the user has a valid authenticated session.Declaration
Swift
public var authorizedStatusCode: Http.StatusCode -
The Http.StatusCode expected to be returned when calling the
authorizationURL, when the user does not have a valid authenticated session.Declaration
Swift
public var unauthorizedStatusCode: Http.StatusCode -
The Http.Method to use when calling the
authorizationURLto validate the users session.Declaration
Swift
public var checkMethod: Http.Method -
The timeout period used when calling the
authorizationURLto validate the users session.Declaration
Swift
public var timeout: TimeInterval -
The length of time to cache results from the last
authorizationURLcall. Multiple requests to verify authentication status within this time period will return the same value, thus saving network requests.Declaration
Swift
public var cacheLength: TimeInterval -
Initializes a new ReachabilityConfiguration used to initialize a
Reachabilityobject for determining the device’s online or offline state.Declaration
Swift
public init(authorizationURL: URL?, authorizedStatusCode: Http.StatusCode = .ok, unauthorizedStatusCode: Http.StatusCode = .found, checkMethod: Http.Method = .get, timeout: TimeInterval = ReachabilityConfiguration.defaultTimeout, cacheLength: TimeInterval = ReachabilityConfiguration.defaultCacheLength )Parameters
authorizationURLThe URL to use to verify the current authentication state of the user. If no URL is provided, Reachability will valiate the devices general state and connection to the internet, and potentially it’s offline authentication state, but will be unable to validate it’s online authentication state.
authorizedStatusCodethe
Http.StatusCodeexpected to be returned when calling theauthorizationURLif the user is authenticated. This code results in anonline authenticatedReachabilityStatus. Defaults to Http.StatusCode.okunauthorizedStatusCodethe
Http.StatusCodeexpected to be returned when calling theauthorizationURLif the user is not authenticated. This code results in anonlineReachabilityStatus. Defaults to Http.StatusCode.foundcheckMethodThe Http.Method to use when calling the
authorizationURLto validate the users session. Defaults toHttp.Method.gettimeoutThe timeout period used when calling the
authorizationURLto validate the users session. Defaults toReachabilityConfiguration.defaultTimeoutcacheLengthThe length of time to cache results from the last
authorizationURLcall. Multiple requests to verify authentication status within this time period will return the same value, thus saving network requests. Defaults toReachabilityConfiguration.defaultCacheLength -
Returns a pre-configured ReachabilityConfiguration designed for use with the Predix Sync service. The
authorizationURLwill be retrieved fromUtilities.predixSyncURLand so must be configured in either the application’s Settings, or in the application’s Info.plist.Declaration
Swift
public static var `default`: ReachabilityConfiguration -
Returns a pre-configured ReachabilityConfiguration without an authorizationURL.
Declaration
Swift
public static var noAuthorization: ReachabilityConfiguration
View on GitHub
ReachabilityConfiguration Structure Reference