Nullable out/ref variables are annoying, because they can't be expressed with a single (nice) signature.
Example:
- (void)doSomething:(nullable CGRect *)rect;
I suggest adding generator support for generating multiple functions for this, by specifying the Nullable attribute on the out/ref argument (I'll stick with just ref in the sample to make it simpler, but it applies to both variations):
[Export ("doSomething:")]
void DoSomething ([Nullable] ref CGRect rect);
would produce:
// This is for subclassing & overriding the implementation.
[Export ("doSomething:")]
protected virtual void DoSomething (IntPtr rect)
{
objc_msgSend (...);
}
// Two overloads with nicer signatures.
public void DoSomething ()
{
return DoSomething (IntPtr.Zero);
}
public void DoSomething (ref CGRect rect)
{
unsafe {
fixed (void *refarg1 = &rect)
DoSomething ((IntPtr) refarg1);
}
}
Nullable out/ref variables are annoying, because they can't be expressed with a single (nice) signature.
Example:
- (void)doSomething:(nullable CGRect *)rect;I suggest adding generator support for generating multiple functions for this, by specifying the Nullable attribute on the out/ref argument (I'll stick with just
refin the sample to make it simpler, but it applies to both variations):would produce: