-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Rename some layer and source properties #6098
Comments
Seems to me that this should be an all-or-nothing sort of thing -- either we keep a predictable mapping directly from the style specification, or we conform as closely as possible to Cocoa naming conventions in every case. Mixing and matching conventions sounds confusing. |
I’m mainly concerned about Whatever the case, each property’s documentation should refer to the underlying style specification property (or even link to it) for discoverability. |
I share @1ec5's views here about severity and reasoning (particularly with |
The most critical properties were renamed in #7128 on the v3.4.0 release branch. Here are the next batch of important properties to rename:
|
#7310 took care of #6098 (comment). Can this be closed @frederoni @1ec5? |
@1ec5 @frederoni I removed the release blocker since it seems like all the critical changes are complete. I'll keep this open since it seems like there may be a few properties we still want to consider renaming. |
@frederoni and I aren't too keen on renaming We agree on |
#7344 renamed |
#7391 updates documentation to reflect the above changes. |
#7457 renames a bevy of properties to use the appropriate parts of speech for getters and setters. |
#7603 takes care of the last batch of renames for v3.4.0. Some (but not all) of these renamings should be applied upstream as well:
See also mapbox/mapbox-gl-style-spec#218. |
As mentioned in mapbox/mapbox-gl-style-spec#201, what about |
We already rename "justify" to "justification" as of #7457. We could rename "translate" to "translation" here, but Apple frameworks are less consistent about this word, and to be honest both are considerably less idiomatic than "offset". |
@jfirebaugh, on second thought, I renamed |
Fixed in #7603 on the release-ios-v3.4.0 branch. |
The runtime styling API’s property names come directly from the style specification, which follows more of a CSS naming tradition that differs in many ways from the Cocoa naming convention iOS and macOS developers are accustomed to. Combined with #5970, this means developers really have no clue what to set many properties to unless they read the SDK’s source code or inspect similar properties’ values in the debugger.
Some examples of poorly named properties, starting with the most severe issues and ending with the most benign ones:
iconImage
– The developer would expect to set this property to a CGImage, NSImage, or UIImage, but definitely not a string. It should be callediconImageName
. Even if we fix Add category convenience methods to NSNumber for style values (was: Runtime styling properties are too loosely typed) #5970, developers might expect to pass in a path or URL string to an image, which would fail.textFont
– The developer would expect to set this property to an NSFont or UIFont, or perhaps an NSFontDescriptor or UIFontDescriptor, but definitely not an array of strings. It should be calledtextFontNames
.rasterBrightnessMin
andrasterBrightnessMax
– Minimum and maximum are always written out, so abbreviating them looks sloppy in Objective-C and Swift.circlePitchScale
– The developer would expect to set this property to a CGFloat. Maybe this would get better once we fix Add category convenience methods to NSNumber for style values (was: Runtime styling properties are too loosely typed) #5970, but another fix would be to rename this propertycirclePitchScaleStategy
or somesuch.lineDasharray
– This is called a “dash pattern” in many Cocoa APIs. Swift in particular has moved away from putting types inside symbol names.rasterHueRotate
– This is a verb, whereas properties should be nouns. This can be a problem in Objective-C, where you can use the same syntax to access a property getter or call a parameter-less method.On the other hand, as important as it is to ensure consistency with the rest of the SDK and with Cocoa APIs, there’s a strong case to be made for consistency with the style specification and GL JS when it comes to the runtime styling API. We should at least make a few conservative changes (like the first two above) and leave the rest of the API intact.
To rename any property, we’ll need an override mechanism like the one envisioned for documentation in #5954.
/cc @frederoni @jfirebaugh @incanus
The text was updated successfully, but these errors were encountered: