aboutsummaryrefslogtreecommitdiff
path: root/Hotline/Models/Server.swift
diff options
context:
space:
mode:
Diffstat (limited to 'Hotline/Models/Server.swift')
-rw-r--r--Hotline/Models/Server.swift16
1 files changed, 13 insertions, 3 deletions
diff --git a/Hotline/Models/Server.swift b/Hotline/Models/Server.swift
index c2063ea..5a6ba80 100644
--- a/Hotline/Models/Server.swift
+++ b/Hotline/Models/Server.swift
@@ -1,16 +1,26 @@
import SwiftUI
-@Observable final class Server {
+@Observable final class Server: Identifiable, Equatable {
+ let id: UUID = UUID()
let name: String
let description: String?
- let users: Int = 0
+ let users: Int
let address: String
let port: Int
- init(name: String, description: String?, address: String, port: Int) {
+ init(name: String, description: String?, address: String, port: Int, users: Int = 0) {
self.name = name
self.description = description
self.address = address
self.port = port
+ self.users = users
+ }
+
+ static func == (lhs: Server, rhs: Server) -> Bool {
+ return lhs.id == rhs.id
+ }
+
+ static func == (lhs: HotlineServer, rhs: Server) -> Bool {
+ return lhs.name == rhs.name && lhs.address == rhs.address && lhs.port == rhs.port
}
}