I can't seem to create an array that contains an user. I have to create and array of 10 users.. How do I properly create it?
import UIKit
enum DeviceType {
case Phone, Tablet, Watch
}
enum OperatingSystemType {
case iOS, Android, Windows
}
struct OperatingSystemVersion {
var Major: Int
var Minor: Int
var Patch: Int
}
struct OperatingSystem{
var type: OperatingSystemType
var version: OperatingSystemVersion
}
class Device {
var DeviceID: Int
var Type: DeviceType
var Operating_System: OperatingSystem
var UserID: Int
var Description: String
var InventoryNR: String
init () {
DeviceID = 1233
Type = .Phone
Operating_System = OperatingSystem(type: .iOS, version: OperatingSystemVersion(Major: 9, Minor: 0, Patch: 2))
UserID = 2
Description = "took"
InventoryNR = "no17"
}
}
class User {
var UserID: Int
var Username: String
var Location: String
var Devices: [Device]
init() {
UserID = 566
Username = "david"
Location = "Fortech"
Devices = [Device.init()]
}
}
var Users = [User] ()
Users.append(UserID: 23, Username: "David", Location: "HQ", Devices : User)
Users and then you can append thatUser.