Last active
August 27, 2019 22:27
-
-
Save torburg/bc751775637e3c61bb21f61939b86134 to your computer and use it in GitHub Desktop.
test gists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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