I want to create a custom keyword programmatically in iphone. For ex. NSLog prints the log in the console. There are my many frameworks that use their own logs (custom logs)like Aphlogs etc. I want to define my own keyword such as MYLogs such that when i use anywhere as MYLogs(stackoverflow); it should call a method "MYLogsCalled" with "stackoverflow" as parameter and i can perform my own actions in that method.
define a custom keyword in ios programmatically
393 Views Asked by Warrior At
1
you can use a macro to do this quickly.
first create the method you want to call, so make a class called
MyLogsand add a methodthen define a macro
the other way is to define an extern function which handles the logs (this is what NSLog does), but using
#definesmakes it cleaner to do things like turn off logs in release builds like DLog typically does