Previously, we declared MGLStyleLayer initializers in the MGLStyleLayer protocol as optional methods. This made it easy to opt in and out of initializers that did or or did not make sense for the subclass. However, this approach was dangerous since it was easy for an application developer to initialize an MGLStyleLayer subclass with an init method that was actually not implemented in that class causing an exception at runtime. This commit moves the init methods that each subclass supports to each subclass so xcode (and the compiler) help the developer avoid the previously possible runtime exception. In addition, a new init method is added that takes the source layer and passes that on to `mbgl::style:Layer` (but only on classes where this is possible in core). This allows an application developer to style a specific source layer (i.e. the contour lines of the mapbox terrain vector source). Finally, this refactors MGLStyleLayer classes to use an MGLSource instead of a string identifier for the source when initializing the style.
Darwin
The code in the Darwin platform targets Apple platforms but is not specific to iOS or macOS. This code is not distributed as an SDK in itself, but is required by the Mapbox iOS SDK and Mapbox macOS SDK.
These files depend on the Foundation and Core Foundation frameworks but do not depend on iOS- or macOS–specific frameworks, such as UIKit or AppKit. Any non-cross-platform code is guarded by TargetConditionals.h macros.