I noticed that in the calculator demo of Stanford CS193p course, the IBOutlet connection was dragged from the label to header file. However, the IBAction connection was directly created in the .m file. I tried reading through the documentation and searched on Google but couldn't find the reason behind this.
I would argue that IBAction digitPressed method should be declared in the header file as well (shouldn't it be part of the interface?).
I am obviously fairly new to Objective C (mostly worked in Java) so I am sure I am missing something basic.
Can anyone please explain?
Declaring things in a class's header file makes them part of the public interface. This includes outlets and actions defined on a view controller.
Whether something ought to be made public is a design question. A good principal is: only if it has to be. With ViewControllers outlets and actions, more often than not, they don't have to be - and therefore shouldn't be - public.
What usually happens is that you make some guesses up front about what the public interface should contain, then (if you're a tidy developer) you take a look again when the implementation is matured and remove anything inessential.