Skip to content

How to use cocoalumberjack with Swift #405

Closed
@GuyFran

Description

@GuyFran

Hi.
I've been reading here and there, and I am unsure how to use the framework with swift.

I've seen people aking their own wrappers in swift, but that was quite some months ago.

Following the issues in there, my understanding is that there's an official swift wrapper for using cocoalumberjack.

Having retrieved the lib with cocoapods , the beta 4 from 2.0.0, I still don't see any swift class there, and none of the example projects uses a swift also.

So I'm kinda confused how to make that work with the "official" means.

Any light that you can shed on this ?

Thx

Activity

rivera-ernesto

rivera-ernesto commented on Nov 27, 2014

@rivera-ernesto
Member

I think that for now you should install the standard Objective-C library with CocoaPods and then manually import the CocoaLumberjack.swift wrapper, as CocoaPods doesn't yet support Swift.

I will just make sure that the wrapper is preserved in the directory as currently it gets deleted by CocoaPods.

rivera-ernesto

rivera-ernesto commented on Nov 27, 2014

@rivera-ernesto
Member

Also there is #400.

GuyFran

GuyFran commented on Nov 27, 2014

@GuyFran
Author

I have added , as usual, the lib pod to my podfile. It's there.

Now I've manually imported the CocoaLumberjack.swift to my project (in swift).
But I get a compile error : import CocoaLumberjack -> "No such module"

Do I need to add on something ? Tweak the bridging header file ?

palewar

palewar commented on Nov 27, 2014

@palewar
GuyFran

GuyFran commented on Nov 28, 2014

@GuyFran
Author

I have followed the procedure indicated, and it's working for alamofire and swiftjson.

Not working for cocoalumberjack though.
I tried to paste

pod 'CocoaLumberjack', :git => "https://github.com/CocoaLumberjack/CocoaLumberjack.git", :branch => "podspec"

in my Podfile. No success. What would be the proper line for the podfile for this library ?

palewar

palewar commented on Nov 28, 2014

@palewar

@crazykoala Give this a try:

pod 'CocoaLumberjack', :git => "https://github.com/ValCapri/CocoaLumberjack.git"

GuyFran

GuyFran commented on Nov 28, 2014

@GuyFran
Author

Ok this retrieves the pod with the .swift wrapper.

But still it doesn't compile afterwards.

  • If I uses "pod install" to retrieve my pods, i get this error "import CocoaLumberjack : No such module'
  • If I use "bundle exec pod install" to retrieve the pods , the .h of the other pods are not found. Erf.

Really no luck :/

rivera-ernesto

rivera-ernesto commented on Nov 28, 2014

@rivera-ernesto
Member

@palewar Maybe also include the :commit.

GuyFran

GuyFran commented on Nov 28, 2014

@GuyFran
Author

@rivera-ernesto , is there such a way with the "official" repo ?

Or is there a step by step guide on how to include the lib with a swift project ? (with or without cocoapods)

rivera-ernesto

rivera-ernesto commented on Nov 28, 2014

@rivera-ernesto
Member

Yes. You just set the official repository in the :git part.

GuyFran

GuyFran commented on Dec 1, 2014

@GuyFran
Author

I see , but I'm actually trying to get it working with Swift.

@palewar , when I use this branch, I get the swift class, but I get an error upon compile : " No such module CocoaLumberjack" on the import line.

Could you help me fix this ?

rivera-ernesto

rivera-ernesto commented on Dec 1, 2014

@rivera-ernesto
Member

Closing this in favor of #383.

palewar

palewar commented on Dec 1, 2014

@palewar

@crazykoala Probably a silly question, but are you using .xcworkspace file to open and build project? Please share your Podfile with me or your github URL if it's a public project and I will see if I can do anything to get it working.

67 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @wimhaanstra@bpoplauschi@johndpope@dnkoutso@nateuni

        Issue actions

          How to use cocoalumberjack with Swift · Issue #405 · CocoaLumberjack/CocoaLumberjack