Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return instancetype for shared RCTI18nUtil instance #16196

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion React/Modules/RCTI18nUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
*/
@interface RCTI18nUtil : NSObject

+ (instancetype)sharedInstance;

- (BOOL)isRTL;
- (BOOL)isRTLAllowed;
- (void)allowRTL:(BOOL)value;
- (BOOL)isRTLForced;
- (void)forceRTL:(BOOL)value;
+ (id)sharedInstance;

@end
16 changes: 9 additions & 7 deletions React/Modules/RCTI18nUtil.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@

@implementation RCTI18nUtil

+ (id)sharedInstance {
static RCTI18nUtil *sharedRCTI18nUtilInstance = nil;
@synchronized(self) {
if (sharedRCTI18nUtilInstance == nil)
sharedRCTI18nUtilInstance = [self new];
}
return sharedRCTI18nUtilInstance;
+ (instancetype)sharedInstance
{
static RCTI18nUtil *sharedInstance;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [self new];
});

return sharedInstance;
}

/**
Expand Down