URLRequestHeater

public class URLRequestHeater<Object> where Object : WarmableURL

An URLRequestHeater warms up an Object that has an associated operation that requieres an URLRequest It provies a function warm up objects, and retrieve them.

Objects can be enqueued by using an URL, URLRequest, or none.

Dequeue can be done at any time, but that doesn’t meed the object is fully loaded. Yet, it should be usable. If an object is dequeued without specifiygin an URL or URLRequest, a default (warmedup) object is returned.

  • starts warming up a new Object identified by an URL

    Declaration

    Swift

    func warmUp(with url: URL)

    Parameters

    url

    an URL that will be sent as param in the creation closure. Object is identified by this url

  • starts warming up a new Object identified by an urlString

    Declaration

    Swift

    func warmUp(with request: URLRequest)

    Parameters

    request

    an URL Request that will be sent as param in the creation closure. Object is identified by its absolute URL String.

  • Dequeues an anonymous object (not initialized with any URL)

    Declaration

    Swift

    func dequeue() -> Object

    Return Value

    an Object

  • Dequeues a named object if available

    Declaration

    Swift

    func dequeue(with url: URL) -> Object?

    Parameters

    url

    an URL that identifies the warmed-up object

    Return Value

    an Object if exists in the URLRequestHeater pool of objects, nil otherwise

  • Dequeues a named object if available

    Declaration

    Swift

    func dequeue(with request: URLRequest) -> Object?

    Parameters

    request

    an URL Request, which absolute URL identifies the warmed-up object

    Return Value

    an Object if exists in the URLRequestHeater pool of objects, nil otherwise

  • Removed all the warmed-up objects

    Declaration

    Swift

    func clear()

Available where Object == WKWebView

  • An instance of WKWebViewHeater that has a default configuration for all the WKWebViews warmedup by this heater.

    Default Configuration uses the same WKProcessPool for all the WKWebViews return by the heater.

    Declaration

    Swift

    private(set) static var shared: WKWebViewHeater { get }
  • Creates an instance of WKWebViewHeater that has a common configuration for all the WKWebViews warmedup by this heater.

    Apart from the provided configuration, all WKWebView share the same WKProcessPool

    Declaration

    Swift

    convenience init(sharedManager: WKWebViewSharedManager)