mapbox / MapboxStatic.swift

Static map snapshots with overlays in Swift or Objective-C on iOS, macOS, tvOS, and watchOS
https://www.mapbox.com/api-documentation/?language=Swift#static
Other
189 stars 31 forks source link

Prevent dynamic dispatch from being used #66

Closed frederoni closed 7 years ago

frederoni commented 7 years ago

Fixes #65 Swift or Obj-C applications extending UIColor or NSColor like:

extension UIColor {
    func toHexString() -> String {
        return "#000000"
    }
}

would override the internal toHexString() which excludes the # and would cause a corrupt URL. This method gets overridden because the class inherits from NSObject and therefore makes use of dynamic dispatching.

Note that Swift 4.0 in unaffected by this bug/feature.

@1ec5 👀

friedbunny commented 7 years ago

Thanks to @jrose-apple for making quick work of this question at the Swift lab this morning. 🙇

1ec5 commented 7 years ago

Thanks @jrose-apple! 👋