Files
NetNewsWire/Shared/AboutData.swift
Stuart Breckenridge e2eeed8f99 Target macOS 13
• `xcconfig` `MACOSX_DEPLOYMENT_TARGET` updated to 13.0
• Removed `@available` annotations for macOS < 13.0
• Removed for Big Sur fixes.

This has been built and doesn’t trigger any build settings should be `xcconfig` options.
2023-05-30 09:15:08 +08:00

46 lines
1.1 KiB
Swift

//
// AboutData.swift
// NetNewsWire-iOS
//
// Created by Stuart Breckenridge on 02/10/2022.
// Copyright © 2022 Ranchero Software. All rights reserved.
//
import Foundation
@available(iOS 15, *)
protocol LoadableAboutData {
var about: AboutData { get }
}
@available(iOS 15, *)
extension LoadableAboutData {
var about: AboutData {
guard let path = Bundle.main.path(forResource: "About", ofType: "plist") else {
fatalError("The about plist really should exist.")
}
let url = URL(fileURLWithPath: path)
let data = try! Data(contentsOf: url)
return try! PropertyListDecoder().decode(AboutData.self, from: data)
}
}
@available(iOS 15, *)
struct AboutData: Codable {
var PrimaryContributors: [Contributor]
var AdditionalContributors: [Contributor]
var ThanksMarkdown: AttributedString {
let dataURL = Bundle.main.url(forResource: "Thanks", withExtension: "md")!
return try! AttributedString(markdown: Data(contentsOf: dataURL), options: AttributedString.MarkdownParsingOptions(interpretedSyntax: .inlineOnlyPreservingWhitespace))
}
struct Contributor: Codable {
var name: String
var url: String?
var role: String?
}
}