Skip to content

Commit

Permalink
Deeplink: encode method documentation has been added.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Lobanov committed Jan 31, 2024
1 parent 325a6f8 commit b23ebb3
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion Sources/Deeplink/Deeplink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,27 @@ public enum Deeplink<Value>: 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<Ticket>
///
/// 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 {
Expand Down

0 comments on commit b23ebb3

Please sign in to comment.