0

I'm new to Cocoapods and am trying to use a pod named DateTools in my OS X app Swift project.

I installed Cocoapods, created the podfile, added pod 'DateTools' to it, ran pod install and everything seemed to work fine. (I'm a Ruby dev so I think I got this part right).

As asked by Cocoapods, I now opened my project using the new .xcworkspace file created. I correctly see two projects in Xcode: mine and Pods.

I added a sample model file to my project, let's call it SampleModel but in the code, when I do this:

let date = NSDate()
var year = date.year

I get the error: 'NSDate' does not have a member named 'year'. According to DateTools README, this should work.

As I'm new to both Xcode and Cocoapods, I can't figure out what is the likely error: DateTools not working with Swift or did I fail to import something, somewhere?

1 Answer 1

4

You need to import module into your source file

import DateTools

Also, by default is CocoaPods building static libraries - to use those you would need to configure bridging header. Easier way is to make it build dynamic framework by specifying so in Podfile (and run pod install):

use_frameworks!

pod 'DateTools'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.