Reputation: 496
I define a function in a separate .m file and then when I want to use it (in other implementation files), I just don't know what to import, to actually see it.
Upvotes: 1
Views: 68
Reputation: 75296
Assuming that you already have a matching .h
file for your .m
file, you just need to add #import "MyUtilityClass.h"
to the header file of whatever other class you want to use your class from.
Upvotes: 1
Reputation: 237020
You need to create a header that declares the function and import that. So if you have the following file:
NSString *MyFavoriteTransformer() {
return @"Hot Rod"; // Come on -- he's awesome!!!!
}
You'll want to have a corresponding file like this:
NSString *MyFavoriteTransformer();
Upvotes: 2