Skip to content

Instantly share code, notes, and snippets.

@lucianoschillagi
Last active December 13, 2017 19:47
Show Gist options
  • Save lucianoschillagi/b83130946e03aa14eae2b50d076e61fc to your computer and use it in GitHub Desktop.
Save lucianoschillagi/b83130946e03aa14eae2b50d076e61fc to your computer and use it in GitHub Desktop.
struct Arduino {
// properties without default value
var model: String
var microcontroller: String
var digitalIOPins: Int
}
let myArduino = Arduino(model: "Yún", microcontroller: "ATmega32U4", digitalIOPins: 20) // memberwise initializer
myArduino.model // prints "Yún"
let otherArduino = Arduino(model: "Uno", microcontroller: "ATmega328P", digitalIOPins: 14) // memberwise initializer
otherArduino.microcontroller // prints "ATmega328P"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment