The array does not append with a custom class object
// Create an array with String and Double
var shoppingList = ["Eggs", 2.0]
// Append array with string object
shoppingList += ["Milk"]
// Declare an example class
class Foo {
var name : String?
func Foo() {
name = "Default Name"
}
}
var foo : Foo = Foo()
shoppingList += [foo] // Error : '[NSObject]' is not identical to 'Uint8'
Why would shoppingList not append foo object?