class Config {
//константа типа
static let maxConnections = 3
//свойства типа
//в версии 6
nonisolated(unsafe) static var host = ""
nonisolated(unsafe) static var port = 0
//метод типа
static func getConnection() -> String {
return "\(host):\(port)"
}
}
Config.host = "10.0.0.1"
Config.port = 52
let connection = Config.getConnection()
//connection is "10.0.0.1:52"
print("connection is \(connection)")