put the code to anterior position

correct code exist in the wrong place, it will lead a compiling warning
This commit is contained in:
Zee Ma
2015-10-22 20:08:56 +08:00
parent a7632a2d55
commit 7454df6159

View File

@ -837,9 +837,10 @@ if let bowTie = Product(name: "bow tie") {
class CartItem: Product {
let quantity: Int!
init?(name: String, quantity: Int) {
self.quantity = quantity
super.init(name: name)
if quantity < 1 { return nil }
self.quantity = quantity
}
}
```