Chapter 29: Maps, p 684-685 incorrect statement

just a small detail, not sure if it matters or not but anyway:
book says p684
“The MKAnnotation protocol requires the class to implement three properties: coordinate, title, and subtitle.”

yet the documentation says otherwise, only coordinate is required:
“An object that adopts this protocol must implement the coordinate property. The other methods of this protocol are optional.”

additionally, on page 685, book says:
“That’s because the MKAnnotation protocol delcares all three properties as public. You have to match the protocol declaration exactly and so your properties must have the public attribute as well. If you don’t, Xcode will start whining :] Try removing the public attribute from one variable and see what happens …”

as of my Xcode version, the 3 properties are not declared as public in the protocol and therefore there is no need to declare them as public when conforming to the protocol

https://developer.apple.com/documentation/mapkit/mkannotation

I don’t recall if this has changed recently or not, but things change all the time as new iOS versions come out. So the information probably was correct at the point it was written. Unfortunately, it no longer seems to be the case. Thanks for the heads up :slight_smile: I’ll fix this for the next release.

This topic was automatically closed after 166 days. New replies are no longer allowed.