GithubHelp home page GithubHelp logo

Comments (8)

davepatterson avatar davepatterson commented on August 17, 2024 7

Simply adding import NSDate_TimeAgo to the .swift file you intend to use it in will work. There's no need to add #import "NSDate+TimeAgo.h" to your bridging header as NSDate+TimeAgo comes with an extension for swift.

from nsdate-timeago.

mohamede1945 avatar mohamede1945 commented on August 17, 2024 1

Actually, when you import NSDate_TimeAgo You will be using the Objective-c API not the swift API, see the podspec here only adds '*.{h,m}' objective-c files not swift files. So, to fix it we need to make it '*.{h,m,swift}'.

from nsdate-timeago.

mohamede1945 avatar mohamede1945 commented on August 17, 2024 1

Also, they updated the podspec, but they didn't release a new version on cocoapods.

from nsdate-timeago.

smasry avatar smasry commented on August 17, 2024

Works fine for me.
#import "NSDate+TimeAgo.h"

from nsdate-timeago.

mohamede1945 avatar mohamede1945 commented on August 17, 2024

Here is a screenshot of what has been added from the cocoapod.
screen shot 2017-05-06 at 11 17 21 pm
There is no swift files at all.

from nsdate-timeago.

dimohamdy avatar dimohamdy commented on August 17, 2024

@mohamede1945 podspec changed but there isn't any swift files How you fix this?

from nsdate-timeago.

mohamede1945 avatar mohamede1945 commented on August 17, 2024

You can use objective-c classes just bridge your swift Date to NSDate.
Here is an example

import NSDate_TimeAgo

extension Date {
    func bookmarkTimeAgo() -> String? {
        return (self as NSDate).timeAgo(withLimit: 60 * 60 * 24 * 7, dateFormat: .full, andTimeFormat: .none)
    }
}

from nsdate-timeago.

dimohamdy avatar dimohamdy commented on August 17, 2024

@mohamede1945 thanks

from nsdate-timeago.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.