krz/domain-dig

an ios app for DNS & SSL analysis

clone: git clone https://gitbay.org/krz/domain-dig.git

v5.0.3: DomainDig/AppLinks.swift · raw

 1import Foundation
 2
 3/// Centralized external destinations, kept in one place so URLs and the App Store
 4/// identifier can be swapped without touching any view.
 5///
 6/// `documentation` points at the repository README for now; swap in a dedicated
 7/// docs site if one lands.
 8enum AppLinks {
 9    /// App Store numeric identifier; the listing/review/share URLs derive from it.
10    static let appStoreID = "6760368004"
11
12    static let sourceCode = url("https://github.com/krazywarez/domain-dig")
13    static let documentation = url("https://github.com/krazywarez/domain-dig#readme")
14    static let privacyPolicy = url("https://krz.sh/domaindig/privacy-policy/")
15    static let supportEmail = "root@krz.sh"
16
17    static var appStoreListing: URL { url("https://apps.apple.com/app/id\(appStoreID)") }
18    static var writeReview: URL { url("https://apps.apple.com/app/id\(appStoreID)?action=write-review") }
19
20    static var copyright: String {
21        let year = Calendar.current.component(.year, from: Date())
22        return "© \(year) Christian Cleberg"
23    }
24
25    /// Builds URLs from developer-controlled literals; a malformed literal is a
26    /// programming error, surfaced loudly in development rather than force-unwrapped.
27    private static func url(_ string: String) -> URL {
28        guard let url = URL(string: string) else {
29            preconditionFailure("Invalid AppLinks URL literal: \(string)")
30        }
31        return url
32    }
33}