I am trying to port a moderately large project from Objective-C into Xamarin.Mac. I am currently trying porting an Objective-C class that implements both NSTableViewDataSource and NSTableViewDelegate. In Objective-C these are protocols, and I can implement as many as I need to, but in Xamarin these are classes, and I can only inherit from one or the other. (Actually, I can't inherit from either, as the class in question already inherits from NSWindowController, as it must.)
I am currently using two private nested classes, but doing so is suboptimal, as I need to keep a reference to the owning window controller, and I do not want a retain cycle. I am currently using a WeakReference to hold the owning window controller in the two nested classes, but then I have to jump through hoops to avoid crashes. What is your recommendation on how to proceed? (I tried removing the nested classes and using the events defined on MonoMac.AppKit.NSTableView, but not all the data-source methods I need have events on NSTableView, and the events that are defined never seem to get fired.)
As a side note: The controller class in question is instantiated in my MainMenu nib file, so will it ever go away? If it doesn't, then this whole memory-management question might be a moot point.