After updating to swift3, the commented line is returning an error: Property 'entity' with type 'GKEntity!' (aka 'ImplicitlyUnwrappedOptional') cannot override a property with type 'GKEntity?'
import SpriteKit
import GameplayKit
class EntityNode: SKNode {
weak var entity: GKEntity! // error here
}
It worked fine before the upgrade. Any idea what is wrong and how to address this?
SKNode
already has a property called entity
which is defined like so:
var entity: GKEntity?
Therefore you can not override that with your entity
of type GKEntity!
So, you can either rename your entity
to something else, or you can use the entity
which already exists.
You can read more about SKNode
here
Hope that helps you :)