Capable
public struct Capable
This class defines the main interface of the Capable framework.
-
Initializes the framework instance with a specified set of features. If no feature was provided, this defaults to all features available on the current platform.
Declaration
Swift
public init(withFeatures features: [CapableFeature] = CapableFeature.allCases)
Parameters
features
An optional array containing the features of interest. This will default to all features available on the current platform.
-
The
statusMap
property returns a dictionary of allCapableFeature
s orHandicap
s , that the Capable instance has been initialized with along with their current statuses. This object is compatible with most analytic SDKs such as Fabric Answers, Firebase Analytics, AppCenter Analytics, or HockeyApp. While most entries can only have a status set to enabled or disabled, the.largerText
feature offers the font scale set by the user.Declaration
Swift
public var statusMap: [String : String] { get }
-
Provides information regarding the current status of a provided feature.
Declaration
Swift
public func isFeatureEnabled(feature: CapableFeature) -> Bool
Parameters
feature
The feature of interest.
Return Value
true
if the given feature has been enabled, otherwisefalse
. -
Provides information regarding the current status of a provided
Handicap
.Declaration
Swift
public func isHandicapEnabled(handicapName: String) -> Bool
Parameters
handicapName
The name of the requested of
Handicap
.Return Value
true
if the given feature has been enabled, otherwisefalse
. Note that the status depends on theHandicap
‘senabledIf
value (seeHandicapEnabledMode
).
-
The minimum log level that should be considered when logging messages. Note that the custom ‘onLog’ closure will only be called for messages of this log type or higher. This value defaults to
OSLogType.debug
.Declaration
Swift
public static var minLogType: OSLogType { get set }
-
A custom closure that should be used by the logger for all Capable instances instead of the default os_log implementation.
Declaration
Swift
public static var onLog: (_ message: String, _ logType: OSLogType) -> Void { get set }
Parameters
message
The message string that is about to be logged.
logType
The ‘OSLogType’ of the message.