Skip to content

Instantly share code, notes, and snippets.

@torburg
Last active August 27, 2019 22:27
Show Gist options
  • Save torburg/bc751775637e3c61bb21f61939b86134 to your computer and use it in GitHub Desktop.
Save torburg/bc751775637e3c61bb21f61939b86134 to your computer and use it in GitHub Desktop.
test gists
class Car {
private var position = (x: 0, y: 0)
public func execute(_ move: Go) {
switch move.direction {
case "right":
self.position.x += move.distance!
case "left":
self.position.x -= move.distance!
case "forward":
self.position.y += move.distance!
case "backward":
self.position.y -= move.distance!
default:
break
}
}
public func getPosition() -> (Int, Int) {
return self.position
}
}
struct Note {
let uid: String
let title: String
let content: String
let color: UIColor
let importance: Importance
let selfDestructDate: Date?
init(uid: String = UUID().uuidString,
title: String,
content: String,
color: UIColor = UIColor.white,
importance: Importance,
selfDestructDate: Date? = nil
) {
self.uid = uid
self.title = title
self.content = content
self.color = color
self.importance = importance
self.selfDestructDate = selfDestructDate
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment