Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Cart {
- let items: [Item]
- var total: UInt {
- return items.reduce(0) { sum, item in
- sum + item.price
- }
- }
- init(items: [Item]) {
- self.items = items
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement