FRDURLRoutes

public class FRDURLRoutes: NSObject

FRDURLRoutes is a way to manage URL routes and invoke them from a URL.

  • Singleton instance of URLRoutes.

    Declaration

    Swift

    public static let sharedInstance = FRDURLRoutes()
  • Registers a url for calling handler blocks.

    Declaration

    Swift

    @discardableResult public func register(url: URL, handler: @escaping URLRoutesHandler) -> Bool

    Parameters

    url

    The url to be registered.

    handler

    The handler to be registered, and will be called while routed.

    Return Value

    True if it registers successfully.

  • Routes a URL, calling handler blocks (for patterns that match URL) until one returns YES.

    Declaration

    Swift

    public func route(url: URL) -> Bool

    Parameters

    url

    The url for search.

    Return Value

    True if handler block is found and called, false if handler block is not found.

  • Registers a url for calling handler blocks.

    Declaration

    Swift

    @discardableResult public func register(url: URL, clazz: FRDIntentReceivable.Type) -> Bool

    Parameters

    url

    The url to be registered.

    clazz

    The UIViewController’s class to be registered, and this view controller will be started while routed.

    Return Value

    True if it registers successfully.

  • Registers with a plist file.

    Declaration

    Swift

    public func registers(plistFile: String) -> Bool

    Parameters

    plistFile

    The plistFile path.

    Return Value

    True if it registers successfully.