WebcomNotification
public struct WebcomNotification : CustomDebugStringConvertible
A value representing a remote notification sent by the back-end.
-
A value representing an error.
See moreDeclaration
Swift
public enum Error : Swift.Error
-
The configuration for the application to which this notification relates.
Intrinsically, a notification relates to an application identifier. This configuration corresponds to the latest one used to instantiate a
WebcomApplicationfor this same application identifier in the same app group (as configured using theWebcom.configure(groupName:)method).Declaration
Swift
public let configuration: WebcomConfiguration -
The path to which this notification relates.
Declaration
Swift
public let path: String -
The notified event.
Declaration
Swift
public let event: WebcomNotificationEvent
-
Creates a new instance.
This initializer fails when the
responsecould not be processed by this SDK. This usually means that it was not addressed to it.Declaration
Swift
public init?(response: UNNotificationResponse, jsonDecoder: JSONDecoder = JSONDecoder())Parameters
responseThe
UNNotificationResponseinstance to use to build this instance.jsonDecoderThe JSON decoder to use to decode values.
-
Creates a new instance.
This initializer fails when the
notificationcould not be processed by this SDK. This usually means that it was not addressed to it.Declaration
Swift
public init?(notification: UNNotification, jsonDecoder: JSONDecoder = JSONDecoder())Parameters
notificationThe
UNNotificationinstance to use to build this instance.jsonDecoderThe JSON decoder to use to decode values.
-
Creates a new instance.
This initializer fails when the
requestcould not be processed by this SDK. This usually means that it was not addressed to it.Declaration
Swift
public init?(request: UNNotificationRequest, jsonDecoder: JSONDecoder = JSONDecoder())Parameters
requestThe
UNNotificationRequestinstance to use to build this instance.jsonDecoderThe JSON decoder to use to decode values.
-
Creates a new instance.
Throws
AnErrorvalue when theuserInfocould not be processed by this SDK. This usually means that the notification was not addressed to it.Declaration
Swift
public init(userInfo: [AnyHashable : Any], jsonDecoder: JSONDecoder = JSONDecoder()) throwsParameters
userInfoThe custom information associated with the received notification to use to build this instance.
jsonDecoderThe JSON decoder to use to decode values.
-
Creates an instance of the application to which this notification relates.
The returned application has all services available, whether they require the JavaScript API or not.
It is configured using the
configurationproperty. However, whendisablesCacheistrue, which is the recommended setting, theWebcomConfiguration.cacheModepropriety is implicitly set to.no. This reduces the memory footprint. Either way, caches cannot be synchronized between different processes (for example a main app and its extensions).Declaration
Swift
public func application(disablesCache: Bool = true) -> WebcomApplication?Parameters
disablesCacheIndicates whether to disable the cache.
Return Value
An application initialized with the configuration to which this notification relates, or
nilwhen an application could not be initialized with that configuration. -
Creates an instance of the application to which this notification relates.
The returned application has all services available, whether they require the JavaScript API or not. It is configured using the
configurationproperty.Declaration
Swift
public func application(_ marker: WebcomMarkers.NoJavaScriptAPI) -> WebcomApplicationParameters
markerUse the
WebcomMarkers.NoJavaScriptAPI.noJavaScriptAPIvalue to disambiguate with theapplication(disablesCache:)overload.Return Value
An application initialized with the configuration to which this notification relates.
-
Returns the first match of a regular expression within the path of this value.
Declaration
Swift
public func pathMatch(regex: NSRegularExpression?) -> NSTextCheckingResult?Parameters
regexThe regular expression against which to match the path.
Return Value
The first match of the regular expression within the path, or
nilwhen the path does not match the regular expression. -
Returns the first match of a regular expression within the path of this value.
Declaration
Swift
public func pathMatch(pattern: String) -> NSTextCheckingResult?Parameters
patternThe pattern to use to build the regular expression against which to match the path.
Return Value
The first match of the regular expression within the path, or
nilwhen thepatternis invalid or the path does not match the regular expression. -
Indicates whether the path of this value matches a regular expression.
Declaration
Swift
public func pathMatches(regex: NSRegularExpression?) -> BoolParameters
regexThe regular expression against which to match the path.
Return Value
truewhen the path matches the regular expression,falseotherwise. -
Indicates whether the path of this value matches a regular expression.
Declaration
Swift
public func pathMatches(pattern: String) -> BoolParameters
patternThe pattern to use to build the regular expression against which to match the path.
Return Value
truewhen the pattern is valid and the path matches the regular expression,falseotherwise. -
Indicates whether the path of a notification matched a regular expression.
Declaration
Swift
public static func ~= (pattern: String, value: WebcomNotification) -> BoolParameters
patternThe pattern to use to build the regular expression against which to match the path.
valueThe notification whose path must be matched against the regular expression.
Return Value
truewhen the pattern is valid and the path of the notification matches the regular expression,falseotherwise. -
Returns a substring of the path.
This method is designed to be used together with the
pathMatch(pattern:)method.Declaration
Swift
public func pathSubstring(with range: NSRange) -> String?Parameters
rangeThe range to retrieve.
Return Value
A string containing the characters within the
rangeornilif therangeis invalid. -
The keys and the values of the updated children of a node.
This property in
nilwhen this remote notification does not correspond toWebcomNotificationEvent.childrenUpdateevent or when full details about the update are not available, i.e. wheneventdoes not match the.childrenUpdate(.full)case.Declaration
Swift
public var childrenUpdateFullDetails: WebcomNotificationEvent.ChildrenUpdateFullDetails? { get } -
The revocation reason.
This property is
nilwhen this remote notification does not correspond to aWebcomNotificationEvent.revocationevent.Declaration
Swift
public var revocationReason: WebcomNotificationEvent.RevocationReason? { get }
-
Declaration
Swift
public var debugDescription: String { get }