Skip to content

Instantly share code, notes, and snippets.

@aainaj
Last active May 20, 2018 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aainaj/98ca434f31f9bd677ad4f4de24de98bf to your computer and use it in GitHub Desktop.
Save aainaj/98ca434f31f9bd677ad4f4de24de98bf to your computer and use it in GitHub Desktop.
Optional property types for struct
import Foundation
struct Product {
let identifier: Int
let name: String
var description: String?
init(identifier: Int, name: String) {
self.identifier = identifier
self.name = name
}
}
let productA = Product(identifier: 1234,
name: "Remote car")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment