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
WebcomApplication
for 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
response
could 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
response
The
UNNotificationResponse
instance to use to build this instance.jsonDecoder
The JSON decoder to use to decode values.
-
Creates a new instance.
This initializer fails when the
notification
could 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
notification
The
UNNotification
instance to use to build this instance.jsonDecoder
The JSON decoder to use to decode values.
-
Creates a new instance.
This initializer fails when the
request
could 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
request
The
UNNotificationRequest
instance to use to build this instance.jsonDecoder
The JSON decoder to use to decode values.
-
Creates a new instance.
Throws
AnError
value when theuserInfo
could 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()) throws
Parameters
userInfo
The custom information associated with the received notification to use to build this instance.
jsonDecoder
The 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
configuration
property. However, whendisablesCache
istrue
, which is the recommended setting, theWebcomConfiguration.cacheMode
propriety 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
disablesCache
Indicates whether to disable the cache.
Return Value
An application initialized with the configuration to which this notification relates, or
nil
when 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
configuration
property.Declaration
Swift
public func application(_ marker: WebcomMarkers.NoJavaScriptAPI) -> WebcomApplication
Parameters
marker
Use the
WebcomMarkers.NoJavaScriptAPI.noJavaScriptAPI
value 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
regex
The regular expression against which to match the path.
Return Value
The first match of the regular expression within the path, or
nil
when 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
pattern
The 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
nil
when thepattern
is 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?) -> Bool
Parameters
regex
The regular expression against which to match the path.
Return Value
true
when the path matches the regular expression,false
otherwise. -
Indicates whether the path of this value matches a regular expression.
Declaration
Swift
public func pathMatches(pattern: String) -> Bool
Parameters
pattern
The pattern to use to build the regular expression against which to match the path.
Return Value
true
when the pattern is valid and the path matches the regular expression,false
otherwise. -
Indicates whether the path of a notification matched a regular expression.
Declaration
Swift
public static func ~= (pattern: String, value: WebcomNotification) -> Bool
Parameters
pattern
The pattern to use to build the regular expression against which to match the path.
value
The notification whose path must be matched against the regular expression.
Return Value
true
when the pattern is valid and the path of the notification matches the regular expression,false
otherwise. -
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
range
The range to retrieve.
Return Value
A string containing the characters within the
range
ornil
if therange
is invalid. -
The keys and the values of the updated children of a node.
This property in
nil
when this remote notification does not correspond toWebcomNotificationEvent.childrenUpdate
event or when full details about the update are not available, i.e. whenevent
does not match the.childrenUpdate(.full)
case.Declaration
Swift
public var childrenUpdateFullDetails: WebcomNotificationEvent.ChildrenUpdateFullDetails? { get }
-
The revocation reason.
This property is
nil
when this remote notification does not correspond to aWebcomNotificationEvent.revocation
event.Declaration
Swift
public var revocationReason: WebcomNotificationEvent.RevocationReason? { get }
-
Declaration
Swift
public var debugDescription: String { get }