Webcom

public enum Webcom

A namespace for global stuff for the SDK.

This enumeration does not contain any case, since it is only used as a namespace.

Properties

  • The short name of the SDK.

    Declaration

    Swift

    public static let shortName: String
  • The full name of the SDK.

    Declaration

    Swift

    public static let fullName: String
  • The version number of the SDK.

    Declaration

    Swift

    public static let version: String
  • The home page of the SDK.

    Declaration

    Swift

    public static let home: URL
  • The default platform.

    This value is used as the default value for the WebcomConfiguration.platform property.

    Declaration

    Swift

    public static let defaultPlatform: URL
  • The default push notification subscription refresh ratio.

    This value is used as the default value for the WebcomConfiguration.pushNotificationRefreshDurationRatio property.

    Declaration

    Swift

    public static let defaultPushNotificationRefreshRatio: UInt

Configuration

  • Configures the SDK.

    This method may be called multiple times but it produces effects only the first time. On next calls, it is a no-operation. It is implicitly called with default arguments when initializing the first WebcomApplication instance. So, you should call it before that if you want to use custom arguments.

    Declaration

    Swift

    public static func configure(groupName: String? = nil)

    Parameters

    groupName

    The app group, used to share data between the main application and extensions.

Logs

  • The user defaults key for the minimum level of logs to emit.

    This key is used to initialize the minimumLogLevel property.

    Declaration

    Swift

    public static let minimumLogLevelKey: String
  • The minimum level of logs to issue.

    A log is issued when its level is more important than or equal to the value of this property (see WebcomLog.Level.>=). When this property is nil, no log is issued.

    It is initialized using the string value of the minimumLogLevelKey key, but applications may modify it.

    Declaration

    Swift

    public static var minimumLogLevel: WebcomLog.Level? { get set }
  • log

    The customized closure used by the SDK for logging.

    The closure takes in parameter a single WebcomLog value.

    It is only called for logs whose level is more important than or equal to minimumLogLevel.

    It is designed to be set by applications. When this property is nil, the WebcomLog.systemLog() method is used instead.

    Declaration

    Swift

    public static var log: ((WebcomLog) -> Void)?

URL Session

  • Gets a default-configured URLSessionConfiguration instance.

    This method is used to initialize the defaultSession property.

    Declaration

    Swift

    public static func defaultSessionConfiguration() -> URLSessionConfiguration
  • The URLSession instance used by default by the SDK.

    The initial value of this property is a session configured using the defaultSessionConfiguration method.

    If it is necessary to modify this property, this should be done before it is read for the first time. Also, since the SDK uses it for many operations, it is best to do this early in the application lifetime.

    Declaration

    Swift

    public static var defaultSession: URLSession

Callback Queue

  • The DispatchQueue used by default to dispatch callbacks.

    The initial value of this property is .main.

    Declaration

    Swift

    public static var defaultCallbackQueue: DispatchQueue

Push Notifications

  • The device token for push notifications.

    The setter is designed to be called from the messaging(_:didReceiveRegistrationToken:) method of the MessagingDelegate protocol from the Firebase module.

    Declaration

    Swift

    public static var deviceToken: String? { get set }

Open URL

  • Tries to open an URL with the SDK.

    This method is designed to be called from the application(_:open:options:) method of the UIApplicationDelegate.

    Declaration

    Swift

    public static func openURL(_ url: URL) -> Bool

    Parameters

    url

    The URL to open.

    Return Value

    true if the URL has been processed by the SDK, false otherwise.

Default Application & Configurations

  • A value representing an error when reading configurations.

    See more

    Declaration

    Swift

    public enum ConfigurationError : Swift.Error
  • The default application.

    It corresponds to the first application configured using the Webcom.shortName key of the information dictionary file (Info.plist) file of the .main bundle.

    An iOS application will typically use a single Webcom application. This property is designed to be the instance representing it.

    Declaration

    Swift

    public static let defaultApplication: WebcomApplication
  • The default configurations.

    The default configurations are specified using the Webcom.shortName key of the information dictionary file (Info.plist) of the .main bundle.

    Declaration

    Swift

    public static let defaultConfigurations: [WebcomConfiguration]
  • Gets the configurations from the information dictionary file (Info.plist) of a bundle.

    Throws

    A ConfigurationError value when the information dictionary file does not contain the key key or an unspecified error when the corresponding value could not be decoded as expected.

    Declaration

    Swift

    public static func configurations(from bundle: Bundle = .main, withKey key: String = shortName) throws -> [WebcomConfiguration]

    Parameters

    bundle

    The bundle whose information dictionary file must be read.

    key

    The key of the information dictionary file to read.

    Return Value

    The newly created configurations.