-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[ios] Adds support for MGLCollisionBehaviorPre4_0 in NSUserDefaults #13426
Conversation
…values in plist.
d096450
to
1b5dead
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I leave two comments but already approved since are minor changes. Regarding the previous public function going private I looked our API docs and is not documented so I think we are fine making this private.
if (collisionBehaviourNumber) { | ||
_perSourceCollisions = collisionBehaviourNumber.boolValue; | ||
} else { | ||
// Also support NSString to correspond with the behavior of `-[NSUserDefaults boolForKey:]` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is necessary because boolForKey
coerces "YES"/YES/1/"1"/"NO"/NO/0/"0" as BOOL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's only on NSUserDefaults
unfortunately - this is for the property from the NSDictionary
(from the bundle/info.plist). So, I think we need this?
Though strictly speaking it's not documented that @"YES"
/@"NO"
etc. are supported, but given that this PR introduces support for NSUserDefaults
I figured this ought to be included.
(An mgl_boolForKey
might be a nice category method to add to NSDictionary
)
@interface MGLRendererConfiguration () | ||
@property (nonatomic, readwrite) BOOL perSourceCollisions; | ||
@end | ||
|
||
|
||
@implementation MGLRendererConfiguration | ||
|
||
+ (instancetype)currentConfiguration { | ||
return [[self alloc] init]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the addition of the initializers I think we need to make this class a proper singleton. Or is there a reason to have more than one instance for this class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not aware of the history behind currentConfiguration
, but I think it's like this so that it captures the current state, which could change. I agree it's a little confusing - hence my comment above:
(An aside: since currentConfiguration doesn't do anything I'm tempted to remove it too).
Addresses #13155 - adds support for setting
MGLCollisionBehaviorPre4_0
viaNSUserDefaults.standardUserDefaults
.Setting via
NSUserDefaults
takes priority over the value in the application's Info.plist file.