How to use Xcode Logger with Swift
I found this library on Github which looks like a pretty neat replacement for NSLog, but I don't know how to use it with Swift in my iOS project.
I've tried calling XLog
or DLog
in my functions, but I get use of unresolved identifier ...
. I allowed Xcode to create a bridging header and import "XcodeLogger.h" there.
What am I doing wrong?
+3
user5157665
source
to share
1 answer
Looking at the source of the library, XLog and DLog are defined as macros:
#define XLog(input, ...) func_XLog_Output(XLOGGER_TYPE_NSLOG,XLOGGER_LEVEL_SIMPLE,CALLEE,CALLEE_METHOD,FILE_NAME,LINE_NUMBER,input, ##__VA_ARGS__)
Unfortunately Swift doesn't recognize them. The only way to know about this is to create an Objective-C class with static methods that calls macros for you.
0
source to share