Bug 3817

Summary: RunLoop specification
Product: iOS Reporter: Miguel de Icaza [MSFT] <miguel>
Component: Xamarin.iOS.dllAssignee: Sebastien Pouliot <sebastien>
Status: VERIFIED FIXED    
Severity: enhancement CC: arpitj, mono-bugs+monotouch, Rajneeshk, sebastien
Priority: Low    
Version: 5.2   
Target Milestone: (C9)   
Hardware: PC   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:

Description Miguel de Icaza [MSFT] 2012-03-08 17:36:33 UTC
In our class libraries we sometimes expose APIs like this:


[Export ("scheduleInRunLoop:forMode:")]
void Schedule (NSRunLoop aRunLoop, string mode);

Where the "mode" is one of the NSRunLoopMode NSString constants.   But this is not clear to users because the "mode" is just a string.   

Perhaps we should change this to be "NSString" and introduce an NSRunLoop.XXX set of constants to make it more obvious.

At least we need to document the values in the various places.
Comment 1 Rolf Bjarne Kvinge [MSFT] 2012-05-17 10:01:16 UTC
We could also add an enum and map from enum value to string value ourselves.

void Schedule (NSRunLoop aRunLoop, RunLoopMode mode)
{
    NSString smode;
    switch (mode) {
    case RunLoopMode.ModeA: smode = NSRunLoop.ModeA; break;
    ...
    }
    Schedule (aRunLoop, smode);
}


enum RunLoopMode {
    ModeA,
    ModeB,
    ModeC,
}
Comment 2 Miguel de Icaza [MSFT] 2012-05-17 11:08:43 UTC
Agreed, I think we should expose both;  The string version for compatibility reasons, the enum version for all known values today.
Comment 3 Sebastien Pouliot 2016-09-15 17:29:16 UTC
https://github.com/xamarin/xamarin-macios/pull/840
Comment 4 Sebastien Pouliot 2016-09-19 12:39:26 UTC
Merged in xamarin-macios/master 3b1586f91b6c41f1220d2ad45d6938d9dcbdb72a