Add Relay Detail View

Changelog-Added: Relay Detail View
Closes: #479
This commit is contained in:
Joel Klabo
2023-02-01 13:49:32 -08:00
committed by William Casarin
parent 852609ee30
commit 552402f2b5
5 changed files with 165 additions and 1 deletions

View File

@@ -0,0 +1,26 @@
//
// 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
}
}