Last active
August 29, 2015 14:21
-
-
Save jakemarsh/913c5d55dff53eb17f56 to your computer and use it in GitHub Desktop.
little-bites-of-cocoa-002-chainable-methods
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
enum CountdownType: Int { case ToTheSecond, ToTheDay } | |
enum ColorScheme: Int { case AfterMidnight, ClassyYellow, Tealfish } | |
class Concern { | |
var title: String = "" | |
func title(aTitle: String?) -> Concern { title = aTitle ?? ""; return self } | |
var subtitle = "" | |
func subtitle(aSubtitle: String?) -> Concern { subtitle = aSubtitle ?? ""; return self } | |
var countdownType: CountdownType = .ToTheSecond | |
func countdownType(type: CountdownType) -> Concern { countdownType = type; return self } | |
var colorScheme: ColorScheme = .AfterMidnight | |
func colorScheme(scheme: ColorScheme) -> Concern { colorScheme = scheme; return self } | |
} |
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
Concern() | |
.title("Big Meeting") | |
.subtitle("With those people from that place") | |
.countdownType(.ToTheDay) | |
.colorScheme(.Tealfish) |
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
Event | |
.withCategory(.Meeting) | |
.withAttendees([User.me]) | |
.sort { $0.startDate < $1.startDate } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment