mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-06-06 23:39:35 +00:00
20 lines
481 B
Swift
20 lines
481 B
Swift
import Foundation
|
|
|
|
public struct Application: Codable, Identifiable, Hashable, Equatable, Sendable {
|
|
public var id: String {
|
|
name
|
|
}
|
|
|
|
public let name: String
|
|
public let website: URL?
|
|
}
|
|
|
|
public extension Application {
|
|
init(from decoder: Decoder) throws {
|
|
let values = try decoder.container(keyedBy: CodingKeys.self)
|
|
|
|
name = try values.decodeIfPresent(String.self, forKey: .name) ?? ""
|
|
website = try? values.decodeIfPresent(URL.self, forKey: .website)
|
|
}
|
|
}
|