Serial Numbers

macOS 10.11/Xcode 8.0 Sometimes, you want items to have serial numbers. This is, to me, the neatest way of creating such unique identifiers – simply use a static variable, and assign it to each new item before incrementing it in the initialiser. class HazSerialNumber { static var serialCounter: Int = 1 let serial: Int init(){ […]