Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Always declare private methods #42
Recent versions of Xcode include some changes to the compiler that make it possible to invoke methods in an implementation regardless of if they are declared and regardless of the method definition order.
When I'm reading an implementation that I'm unfamiliar with the first thing I do is check the private class extension at the top of the implementation file. While it's no longer required, I feel that the benefits of having all of your methods in one place is worth it. It helps avoid leaving around abandoned methods and avoids having to initially scan through the entire implementation. Plus you can put all of your private method docs in one place.
We generally don't test private methods independently – only public APIs (since it's the contract with callers that's important). Of course, there are exceptions for methods that do tricky things, and it's easy enough to declare those cases too.
My point is simply that declarations can be added when necessary or helpful. I don't see why they have to be a requirement.