Created
May 13, 2022 09:23
-
-
Save finestructure/742260260c633c3ec62004f009507306 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum Barcode { | |
case upc(Int, Int, Int, Int) | |
case qrCode(String) | |
} | |
var productBarcode = Barcode.upc(8, 85909, 51226, 3) | |
productBarcode = .qrCode("ABCDEFGHIJKLMNOP") | |
switch productBarcode { | |
case let .upc(numberSystem, manufacturer, product, check): | |
print("UPC : \(numberSystem), \(manufacturer), \(product), \(check).") | |
case let .qrCode(productCode): | |
print("QR code: \(productCode).") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment