Created
November 22, 2015 00:53
-
-
Save ayanonagon/d857926896c19ba09602 to your computer and use it in GitHub Desktop.
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 Cart { | |
let items: [Item] | |
var total: UInt { | |
return items.reduce(0) { sum, item in | |
sum + item.price | |
} | |
} | |
init(items: [Item]) { | |
self.items = items | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment