JsonConfigParser
public struct JsonConfigParser
Parses a unified SDK configuration dictionary.
Wraps a [String: Any] dictionary and provides typed accessors that throw
JsonConfigError on missing or incorrectly-typed fields.
-
Declaration
Swift
public init(_ json: [String : Any]) -
Returns the value for
keycast toT. Throws.missingRequiredFieldwhen absent,.invalidTypeon wrong type.Declaration
Swift
public func required<T>(_ key: String, field: String) throws -> T -
Returns the value for
keycast toT, ordefaultValuewhen absent. Throws.invalidTypeon wrong type.Declaration
Swift
public func optional<T>(_ key: String, field: String, default defaultValue: T) throws -> T -
Returns the value for
keycast toT, ornilwhen absent. Throws.invalidTypeon wrong type.Declaration
Swift
public func optionalValue<T>(_ key: String, field: String) throws -> T? -
Parses
"log"as a log-level string and returns the matchingLogger. Defaults toLogManager.loggerwhen absent. A present but wrong-type value is silently ignored (falls back toLogManager.none) rather than throwing, because log level is advisory and should never block SDK initialisation.Declaration
Swift
public func logLevel() -> Logger -
Parses
"timeout"as milliseconds and returns aTimeIntervalin seconds. Defaults todefaultValuewhen absent.Declaration
Swift
public func timeoutSeconds(default defaultValue: TimeInterval = 15.0) throws -> TimeInterval
View on GitHub