I am trying to learn about creating react-native modules for iOS and there is one aspect that came up
Official documentation on threading mentions this block of code alongside its variations
- (dispatch_queue_t)methodQueue{ return dispatch_get_main_queue();}
There is another undocumented peace I saw a lot in the third party libraries which is this
+ (BOOL)requiresMainQueueSetup{ return NO;}
To me, these look kinda similar yet different, hence I wanted to ask for an explanation of following questions
When should
dispatch_get_main_queue
be added to the module and what happens if it is omitted?When should
requiresMainQueueSetup
be added to the module and what happens if it is omitted?Can
dispatch_get_main_queue
andrequiresMainQueueSetup
be used together, if so why and when?What is the difference between returning
YES
andNO
fromrequiresMainQueueSetup
?