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.
-
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
-
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.
-
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 isnil
, 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 }
-
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
, theWebcomLog.systemLog()
method is used instead.Declaration
Swift
public static var log: ((WebcomLog) -> Void)?
-
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
-
The
DispatchQueue
used by default to dispatch callbacks.The initial value of this property is
.main
.Declaration
Swift
public static var defaultCallbackQueue: DispatchQueue
-
The device token for push notifications.
The setter is designed to be called from the
messaging(_:didReceiveRegistrationToken:)
method of theMessagingDelegate
protocol from theFirebase
module.Declaration
Swift
public static var deviceToken: String? { get set }
-
Tries to open an URL with the SDK.
This method is designed to be called from the
application(_:open:options:)
method of theUIApplicationDelegate
.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.
-
A value representing an error when reading configurations.
See moreDeclaration
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
AConfigurationError
value when the information dictionary file does not contain thekey
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.