If I remember correctly, back when iOS 7 was released, there were a couple of issues regarding the public API of certain classes which implementation was completely changed. The following is an example of what I mean:
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1)
{
[[UINavigationBar appearance] setTintColor: [UIColor colorWithRed:129/255.0 green:200/255.0 blue:244/255.0 alpha:1.0]];
}
else
{
[[UINavigationBar appearance] setBarTintColor: [UIColor colorWithRed:129/255.0 green:200/255.0 blue:244/255.0 alpha:1.0]];
}
In this specific example, prior to iOS 7, the correct way to change the color of the navigation bar was through the use of setTintColor
. Once iOS 7 was out, not only a new method, setBarTintColor
was created for the same purpose, but also, instead of deprecating the previous one, the behavior was modified, causing the breakage of multiple source codes (thus the need of using a conditional if-else
to runtime-check the current version and call the right method).
Does this counts as a violation of the Open/Closed Principle?