Skip to content

Instantly share code, notes, and snippets.

@alimir1
Last active October 17, 2019 04:21
Show Gist options
  • Save alimir1/bd79d7a212ec819907076e997b9fd056 to your computer and use it in GitHub Desktop.
Save alimir1/bd79d7a212ec819907076e997b9fd056 to your computer and use it in GitHub Desktop.
enum FruitType: String {
case fuji, gala, crispin
}
struct Fruit {
var type: FruitType
let expirationDate: Date
}
var apple = Fruit(type: .fuji, expirationDate: Date())
let appleCopy = apple
apple.type = .gala // change apple type
print(apple.type) // gala
print(appleCopy.type) // fuji
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment