The struct values in Swift can be integer, floating point, String, character, Ganso, if the value is not assigned by default to integer and starts at 0, if an integer enumeration and requires that the value of the first value of the enumeration is not starting from 0, the values are automatically followed by 1
References also differ from OC
// Enumeration Definitions enum enumeration Name { case identifier 1, identifier 2 case identifier 3 (Type list) case Identifier 4= Value}// reference enumeration name. identifier // or direct . identifier
Enumerating multiple types of reads
enumBarcode { CaseUPCA (int, int, int) CaseQRCode (String)}//Assign Valuevar a = BARCODE.UPCA (111,222,333) A=. QRCode ("Hello")//Note the same variable can only use the. Identifier () to manipulate the value of the second enumeration structure when it wants to assign it//ReadSwitchProductbarcode { Case . UPCA (Let-numbersystem, let-identifier, let check): println ("upc-a with value of \ (Numbersystem), \ (identifier), \ (check).") Case . QRCode (Let ProductCode): println ("QR code with value of \ (ProductCode).")}
The difference between a class and a struct:
1. struct supports static and static variables
2. The struct does not support delegation
Swift Basic Syntax (v) enumeration, the difference between struct and class