Non-member functions in Objective-C
- by Jellyfingers McSlimedessert
I want to write a standalone function in Objective-C; so essentially a C-style function, with Objective-C calls in it. For example:
NSString* someFunc()
{
NSString* str = [[NSString alloc] init];
return str;
}
I declare the function in a header file, and define in it a .m file. However, the function doesn't appear to be compiled in, as the linker complains about the missing symbol. I thought that maybe I should put it in a C file, but then of course it spat at me for writing Objective-C Nonsense in BASI... C.
What do?