From b23ebb3c31553713f7f9ad53e4c1afd8cb568864 Mon Sep 17 00:00:00 2001 From: Dmitry Lobanov Date: Wed, 31 Jan 2024 14:47:14 +0300 Subject: [PATCH] Deeplink: encode method documentation has been added. --- Sources/Deeplink/Deeplink.swift | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Sources/Deeplink/Deeplink.swift b/Sources/Deeplink/Deeplink.swift index f210f12..8c8c72b 100644 --- a/Sources/Deeplink/Deeplink.swift +++ b/Sources/Deeplink/Deeplink.swift @@ -45,7 +45,27 @@ public enum Deeplink: Equatable, Hashable { case .interpolated(let interpolation): return interpolation } } - + + /// Encodes object into string representation of deeplink + /// + /// Example + /// + /// ```swift + /// struct Ticket { + /// var ticketId: String? + /// } + /// + /// let deeplink = try! "/sell/\(\.ticketId)" as Deeplink + /// + /// var ticket = Ticket(ticketId: "123") + /// let encoded = deeplink.encode(ticket) + /// + /// print(encoded) // "/sell/123" + /// ``` + /// + /// Opposite to parse + /// - Parameter value: object to encode + /// - Returns: string representation of deeplink with specified object public func encode( _ value: Value ) -> String {