Skip to content

DeeplinkParser

ohitsdaniel edited this page Apr 29, 2021 · 5 revisions

DeeplinkParser

DeeplinkParsers parse navigation paths from Deeplinks.

public struct DeeplinkParser 

DeeplinkParsers are wrapper structs around a pure (Deeplink) -> [AnyScreen]? function and support composition.

Returns

If a deeplink parser handles the input Deeplink, it returns a navigation path in the form of an AnyScreen array. If the deeplink parser is not responsible for parsing the deeplink, it returns nil.

Initializers

init(parse:)

public init(parse: @escaping (Deeplink) -> [AnyScreen]?) 

Properties

empty

Empty deeplink parses, not parsing any deeplink

static let empty 

Can be used as a stub value

Methods

parse(_:)

Parses a Deeplink to a navigation path

public func parse(_ deeplink: Deeplink) -> [AnyScreen]? 

Returns

If the DeepLinkParser is responsible for the passed deeplink, it returns the built navigation path. Else nil.

anyOf(_:)

Any of the listed deeplink parsers might take care of parsing the deeplink

static func anyOf(
    _ parsers: [DeeplinkParser]
  ) -> DeeplinkParser 

anyOf(_:)

Any of the listed deeplink parsers might take care of parsing the deeplink

static func anyOf(
    _ parsers: DeeplinkParser...
  ) -> DeeplinkParser 

prepending(path:to:)

Allows you to prepend a navigation path to the feature's entrypoint, given the underlying parses succeeds in parsing the deeplink

static func prepending(
    path pathToEntrypoint: [AnyScreen],
    to parser: DeeplinkParser
  ) -> DeeplinkParser 

In bigger, modularly designed applications, features often have entrypoints. This Deeplink Parses allows you to navigate to the feature's entrypoint before the performing the navigation defined in the deeplink.

Clone this wiki locally