DomainDig/ReleaseNotes.swift

2ad5d8160338d289a65d6a4d1c214a02bf916f1f
domain-dig/DomainDig/ReleaseNotes.swift history · blame · raw

17 lines · 603 bytes

2 symbols in this file
 1import Foundation
 2
 3/// Release notes shown in the "What's New" sheet, loaded from the bundled
 4/// `ReleaseNotes.json`. No network access — the content ships with the app.
 5struct ReleaseNotes: Decodable {
 6    let version: String
 7    let highlights: [String]
 8
 9    static func bundled() -> ReleaseNotes? {
10        guard let url = Bundle.main.url(forResource: "ReleaseNotes", withExtension: "json"),
11              let data = try? Data(contentsOf: url),
12              let notes = try? JSONDecoder().decode(ReleaseNotes.self, from: data) else {
13            return nil
14        }
15        return notes
16    }
17}