This file contains hidden or 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
| struct Car { | |
| let vin: String | |
| var number: String? | |
| } | |
| var newCar = Car(vin: "ZNA123051252OK", number: nil) | |
| newCar.number = "4440PX7" | |
| // Error, vin is constant | |
| // newCar.vin = "" |
This file contains hidden or 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
| let existedUser = User() | |
| let adminUser = User() | |
| let superUser = existedUser | |
| if existedUser === adminUser { | |
| print("existedUser, adminUser both refer to same instance") | |
| } | |
| if existedUser === superUser { | |
| print("existedUser, superUser both refer to same instance") |
This file contains hidden or 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
| class User { | |
| var name: String? | |
| var source: String? | |
| } | |
| let guest = User() | |
| guest.source = "Facebook" | |
| let newUser = guest | |
| newUser.name = "Medusa" |
This file contains hidden or 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
| let speedCamFine = Fine(id: UUID().uuidString, date: Date(), number: "104520", amount: NSNumber(value: 12.5)) | |
| var highSpeedFine = speedCamFine | |
| highSpeedFine.id = UUID().uuidString | |
| highSpeedFine.number = "708908" | |
| print("speedCamFine number: \(speedCamFine.number)") | |
| print("highSpeedFine number: \(highSpeedFine.number)") |
This file contains hidden or 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
| let newFine = Fine(id: UUID().uuidString, date: Date(), number: "104520", amount: NSNumber(value: 12.5)) |
This file contains hidden or 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
| print("fine id: \(fine.id)") | |
| iabService.loadProducts() |
This file contains hidden or 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
| let fine = Fine() | |
| let iabService = IAPService() |
This file contains hidden or 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
| struct Fine { | |
| var id: String = UUID().uuidString | |
| var date: Date? = Date() | |
| var number: String = "" | |
| var amount: NSNumber = NSNumber(value: 0.0) | |
| } | |
| typealias IAPServiceRetriveResult = () -> Void |
This file contains hidden or 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
| struct YourStructure { | |
| // Definition | |
| } | |
| class YourClass { | |
| // Definition | |
| } |
This file contains hidden or 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
| func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { | |
| if let shortcut = Shortcuts(rawValue: userActivity.activityType) { | |
| NotificationCenter.default.post(name: shortcut.notification, object: userActivity) | |
| } | |
| return true | |
| } |