4 ms·
So much this. The other day i was trying to look up documentation for Swift’s KVO and i couldn’t find one. I know there’s a KVO API that accepts a closure but i
by perfectstorm 7y ago
So much this. The other day i was trying to look up documentation for Swift’s KVO and i couldn’t find one. I know there’s a KVO API that accepts a closure but i just couldn’t find where it is. smh.
Apple used to link sample code with pretty much all the big APIs but they no longer do that. If you want to see how an API is used or see the best practices you’re better off checking stackoverflow.
- Austin_Conlon 7y agoWhen I learned that you could filter by sample code in the bottom left search box of Xcode's documentation window, it made sample code a lot more discoverable for me. Of course that's far from ideal though, and they should be linking to sample code more in the documentation.
- saagarjha 7y agoYou're looking for NSObject.observe(_:options:changeHandler:), which doesn't seem to have a dedicated documentation page that I can find but it's mentioned here: https://developer.apple.com/documentation/swift/cocoa_design_patterns/using_key-value_observing_in_swift https://developer.apple.com/documentation/swift/cocoa_design...