Refactor project structure and API
This commit is contained in:
39
Model/API/Server.swift
Normal file
39
Model/API/Server.swift
Normal file
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// Server.swift
|
||||
// iKeyMon
|
||||
//
|
||||
// Created by tracer on 30.03.25.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
struct Server: Identifiable, Codable, Hashable, Equatable {
|
||||
let id: UUID
|
||||
var hostname: String
|
||||
var info: ServerInfo?
|
||||
var pingable: Bool
|
||||
|
||||
init(id: UUID = UUID(), hostname: String, info: ServerInfo? = nil, pingable: Bool = false) {
|
||||
self.id = id
|
||||
self.hostname = hostname
|
||||
self.info = info
|
||||
self.pingable = pingable
|
||||
}
|
||||
|
||||
// MARK: - Manual conformance
|
||||
|
||||
static func == (lhs: Server, rhs: Server) -> Bool {
|
||||
lhs.id == rhs.id && lhs.hostname == rhs.hostname && lhs.info == rhs.info && lhs.pingable == rhs.pingable
|
||||
}
|
||||
|
||||
func hash(into hasher: inout Hasher) {
|
||||
hasher.combine(id)
|
||||
hasher.combine(hostname)
|
||||
hasher.combine(info)
|
||||
hasher.combine(pingable)
|
||||
}
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case id, hostname, info, pingable
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user