Macos – NSTableView available for osx 10.0 but NsTableViewDataSource available for only 10.6


I was looking at the docs for NSTableViewDataSource and they say that this protocol is only available on osx 10.6. How can this be? Isn't NSTableViewDataSource the object that contains all the data for your NsTableView?

Best Solution

To add what @Zydeco wrote, @protocols in Objective-C didn't have @optional attributes before 10.5. So, Apple couldn't use @protocol to define what are the delegate methods, because the delegate objects choose to implement only a part of delegate methods. Apple used something called an informal protocol in those olden days, which were just NSObject categories.

Now that they introduced the way to mark some methods as @optional in a @protocol, they decided to make every delegate a formal protocol in 10.6. This way there can be more compile-time checking. But the functionality has not changed.

See the official documentation on the protocols for more info.