I got the following error when playing around with KVO. Does it only work with subclasses of UIViewController?
Terminating app due to uncaught exception \'NSInte
According to the docs, the name of the method is observeValue(forKeyPath:of:change:context:)
. Note of:
, not ofObject:
as you have. Your method is not an implementation of the required method. I believe you'll need to mark the properly-named method with override
(and the fact that the compiler let you get away without that was a sign that you had the name wrong).