import Foundation import UIKit struct Note { enum Importance: UInt { case unimportant = 0, normal, important } let uid: String var title: String var content: String var color: UIColor var importance: Importance var selfDestructDate: Date? init(uid: String = UUID().uuidString, title: String, content: String, color: UIColor = .white, importance: Importance, destructDate: Date? = nil) { self.uid = uid self.title = title self.content = content self.importance = importance self.color = color selfDestructDate = destructDate } } var a = Note(title: "Note 1", content: "Text 1", importance: .normal) var b = a DispatchQueue.global().async { a.color = .red a.title = "Note changed 1" a.content = "Text changed 1" a.importance = .important a.selfDestructDate = Date() DispatchQueue.main.async { sleep(2) print(">> a \(a)") } } DispatchQueue.global(qos: .utility).async { sleep(3) print(">> utility: b \(b)") } DispatchQueue.global(qos: .background).async { print(">> background: b \(b)") }