WebcomNotification

public struct WebcomNotification : CustomDebugStringConvertible

A value representing a remote notification sent by the back-end.

Types

  • A value representing an error.

    See more

    Declaration

    Swift

    public enum Error : Swift.Error

Stored Properties

  • 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

Initializers

  • 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

    An Error value when the userInfo 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.

API

  • 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, when disablesCacheis true, which is the recommended setting, the WebcomConfiguration.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 the application(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 the pattern 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 or nil if the range is invalid.

  • The new value of the node.

    This property in nil when this remote notification does not correspond to WebcomNotificationEvent.valueChange event or when the new value is not available, i.e. when event does not match the .valueChange(.value) case.

    Declaration

    Swift

    public var value: DataValue? { get }
  • The keys and the values of the updated children of a node.

    This property in nil when this remote notification does not correspond to WebcomNotificationEvent.childrenUpdate event or when full details about the update are not available, i.e. when event 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 a WebcomNotificationEvent.revocation event.

    Declaration

    Swift

    public var revocationReason: WebcomNotificationEvent.RevocationReason? { get }

CustomDebugStringConvertible Protocol

  • Declaration

    Swift

    public var debugDescription: String { get }