URLBuilder

open class URLBuilder

URLBuilder constructs resulting URL by calling URLByAppendingPathComponent method on baseURL.

  • Different behaviors to build URLs from base URL string and path.

    • appendingPathComponent: Construct URL by calling .appendingPathComponent method on URL formed from baseURL string.
    • relativeToBaseURL: Construct URL, using URL(string:relativeTo:) method
    • custom->URL: Construct URL using custom closure that was passed.
    See more

    Declaration

    Swift

    public enum Behavior
  • Base URL string

    Declaration

    Swift

    public let baseURLString: String
  • Behavior to build URL

    Declaration

    Swift

    public let behavior: Behavior
  • Initialize URL builder with Base URL String

    Declaration

    Swift

    public init(baseURL: String, behavior: Behavior = .appendingPathComponent)

    Parameters

    baseURL

    base URL string

  • Construct URL with given path

    Declaration

    Swift

    open func url(forPath path: String) -> URL

    Parameters

    path

    relative path