FLFoundationFactory

public enum FLFoundationFactory

The factory class for module FLFoundation. This class has methods to create types exposed by this module.

  • API to create a Session

    Declaration

    Swift

    public static func session(configuration: URLSessionConfiguration = .default) -> Session

    Parameters

    configuration

    URLSessionConfiguration

  • API to create a SessionTask

    Declaration

    Swift

    public static func sessionTask(requestProvider: URLRequestProvider) -> SessionTask

    Parameters

    requestProvider

    request provider for this task

  • API to create HTTPClient

    HTTPClient instance provides APIs to perform URL loading tasks.

    Declaration

    Swift

    public static func httpClient(configuration: URLSessionConfiguration = .default, defaultHeaders: Headers? = nil) -> HTTPClient

    Parameters

    configuration

    URLSessionConfiguration object if any for the underlying URLSession

    defaultHeaders

    Default Headers to be added to all requests performed by this instance

  • API to create HTTPClient

    HTTPClient instance provides APIs to perform URL loading tasks.

    Declaration

    Swift

    public static func httpClient(session: Session, defaultHeaders: Headers? = nil) -> HTTPClient

    Parameters

    session

    Session instance that is used by this HTTP Client

    defaultHeaders

    Default Headers to be added to all requests performed by this instance

  • API to create Key-Value storage service with KeyValueStore as the underlying service provider.

    Declaration

    Swift

    public static func keyValueStore(name: String, storeDirectory: String? = nil) -> KeyValueStore

    Parameters

    name

    The name of the store.

  • The unified logger service with OSLog as the underlying service provider.

    Custom log objects are identified by an identifier string (in reverse DNS notation, like com.your_company.your_subsystem_name) and a category for the logging subsystem. Both of these are used to categorize and filter related log messages and group related logging settings.

    Declaration

    Swift

    public static func logger(with subsystem: String, category: String) -> Logger

    Parameters

    subsystem

    subsystem

    category

    category

  • The FLError conformed struct object

    Declaration

    Swift

    public static func error(errorCode: Int, errorDescription: String, internalError: FLError? = nil, contextualDescription: String? = nil) -> FLError

    Parameters

    errorCode

    error code of this error in context

    errorDescription

    error desciption of the error in context

    internalError

    internal error for the error in context

    contextualDescription

    contextual description of the error in context

  • The FLExceptionError conformed struct object

    Declaration

    Swift

    public static func error(errorCode: Int, errorDescription: String, internalError: FLError? = nil, contextualDescription: String? = nil, exceptionError: Error) -> FLExceptionError

    Parameters

    errorCode

    error code of this error in context

    errorDescription

    error desciption of the error in context

    internalError

    internal error for the error in context

    contextualDescription

    contextual description of the error in context

    exceptionError

    exception error that caused the error in context

  • API to create FLDeviceSecurity instance.

    Declaration

    Swift

    public static func flDeviceSecurity() -> FLDeviceSecurity
  • Undocumented

    Declaration

    Swift

    public static func createVMapParser(url: String, allCases: [VMapParser.Element]) -> VMapParser
  • API to retrive array of WebVTTModel with http request

    User requested with remote url and completion give it back response to user

    Note

    Default value is provided for http client with default configuration.

    Declaration

    Swift

    public static func retriveWebVTT(
        for url: String,
        client: HTTPClient = FLFoundationFactory.httpClient(),
        completion: @escaping (Result<[WebVTTModel], Error>) -> Void
    )

    Parameters

    url

    remote url

    client

    To make an network request

  • Builds a default user agent string from system information.

    Constructs a user agent string matching the format: AppName/AppVersion (DeviceType; U; CPU OS <version> like Mac OS X; <DeviceModel> Build/<BuildID>)

    Example: "Quickplay/2.1.0 (iPhone; U; CPU OS 18_4_1 like Mac OS X; iPhone15,2 Build/22E252)"

    This is used as the fallback User-Agent header when no custom user agent is provided in the session configuration.

    Declaration

    Swift

    public static func buildUserAgent() -> String

    Return Value

    A formatted user agent string