Why *docPath() in C?


#1

Why do we need a Helper Function (C programming instead of Objective-C) to get the files location?..is it just because no objective-c function can do it?


#2

There are a few reasons.

One is as a reminder that we can gracefully use C code in our Objective-C programs.

Another is that Objective-C methods are attached to the classes on which they’re declared. Such a helper function, though, from a high-level design aspect, feels classless. That is, it’s a function that you could imagine just about any class needing to use. So we make it a C function so that it stands apart from any particular class.


#3

ok, I get it…thanks!