Files
damus/damus/Util/NIPURLBuilder.swift
Joel Klabo 552402f2b5 Add Relay Detail View
Changelog-Added: Relay Detail View
Closes: #479
2023-02-06 13:21:42 -08:00

27 lines
601 B
Swift

//
// NIPURLBuilder.swift
// damus
//
// Created by Honk on 2/1/23.
//
import Foundation
struct NIPURLBuilder {
static private let baseURL = "https://github.com/nostr-protocol/nips/blob/master/"
static func url(forNIP nip: Int) -> URL? {
let urlString = baseURL + "\(formatNipNumber(nip: nip)).md"
return URL(string: urlString)
}
static func formatNipNumber(nip: Int) -> String {
let formatted: String
if nip < 10 {
formatted = "0\(nip)"
} else {
formatted = "\(nip)"
}
return formatted
}
}