See that post and the accepted answer :
In XCode, is there a way to disable the timestamps that appear in the debugger console when calling NSLog?
How may I, for that example or any other situation, declare a global function that include objective-c calls that I may be able to call directly, like NSLog, without having to make a call like [MyClass myFunction] ?
Just use the standard C syntax; remember, Objective-C is a strict superset of C.
In a .h
file, write the declaration
extern return_type function_name(argument_type1 argument_name1,argument_type2 argument_name 2);
and in a .m
file (or .c
file or whatever), write the implementation
return_type function_name(argument_type1 argument_name1,argument_type2 argument_name 2){
....
}
If it's in a .m
file, it should be put outside of @implementation ... @end
block. (Well, you can put your function within it, but I find it confusing.) That's it!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With