Global import for Swift CocoaLumberjack

2019-09-14 21:49发布

问题:

I configured CocoaLumberjack properly using the swift pod.

And I can log whatever:

DDLogVervose("")
DDLogInfo("")

But I have to in every class to use it:

import CocoaLumberjack

Isnt there a way that I can globaly import ?

回答1:

The only "trick" to have it available in all your classes is to use a pch (precompiled header) and import CocoaLumberjack there. It's a header that gets imported in all your files.