hariszaman
hariszaman

Reputation: 8424

Observing Multiple NSKeyObservingKeyValueoptions swift

How to observe multiple NSKeyObservingKeyValueoptions in swift

 self.avplayerItem.addObserver(self, forKeyPath: "status", options:[.Initial | .New], context: nil)

I get an error like

Error

No '|' candidates produce the expected contextual result type 'NSKeyValueObservingOptions'

Upvotes: 0

Views: 687

Answers (1)

Vatsal
Vatsal

Reputation: 18181

Change

 self.avplayerItem.addObserver(self, forKeyPath: "status", options:[.Initial | .New], context: nil)

to:

 self.avplayerItem.addObserver(self, forKeyPath: "status", options:[.Initial, .New], context: nil)

Upvotes: 7

Related Questions