Skip to content

Instantly share code, notes, and snippets.

@pbonneville
Last active June 29, 2016 20:52
Show Gist options
  • Save pbonneville/0b194066869df689984cea356bb4ce02 to your computer and use it in GitHub Desktop.
Save pbonneville/0b194066869df689984cea356bb4ce02 to your computer and use it in GitHub Desktop.
Sample code for a basic computed value for Swift
// This code is designed to be dropped into Xcode snippets. Paste the code into an Xcode document
// and then drag it onto the Code Snippet library to create a snippet with prompts.
var <# variable name #>: <# variable type #> {
get {
return <# value to return #>
}
set {
// "newValue" is the value that was passed into this variable to be set and is automagically available to you
var <# value to set #> = newValue
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment