Answer the question
In order to leave comments, you need to log in
How to reach the classa element subscribed to the sub protocol?
Please tell me how to do it right so that I can reach out to expired) Newbie don't kick Sin, thanks)!
Answer the question
In order to leave comments, you need to log in
var fridge = [Storable]() // empty array of type Storable fridge
for prod in basket {
if let storableProduct = prod as? Storable where storableProduct.expired == false {
fridge.append(storableProduct)
}
Might be useful to someone
In Swift 3, the syntax for multiple conditions in a single if let has changed:
if let storableProduct = prod as? Storable, storableProduct.expired == false {
fridge.append(storableProduct)
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question