Comments (8)
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.
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.
Also, they updated the podspec, but they didn't release a new version on cocoapods.
from nsdate-timeago.
Works fine for me.
#import "NSDate+TimeAgo.h"
from nsdate-timeago.
Here is a screenshot of what has been added from the cocoapod.
There is no swift files at all.
from nsdate-timeago.
@mohamede1945 podspec changed but there isn't any swift files How you fix this?
from nsdate-timeago.
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.
@mohamede1945 thanks
from nsdate-timeago.
Related Issues (20)
- Time Ahead HOT 3
- "3 месяцев назад" -> "3 месяца назад"
- Swift 3
- Persian (fa) localization
- Crashing in iOS 10.2 version only in release version
- Bahasa Strings HOT 2
- Slovak strings - rename file
- How to add New Language ?
- let dateFormatter: NSDateFormatter = NSDateFormatter()
- time to HOT 2
- Part of zh-Hans.lproj is not right
- arm64 Support!
- iOS8.0 deprcated HOT 2
- Swift timeAgo returns empty string. HOT 6
- Carthage Support
- Pluralization dont work because wrong RU locale code HOT 1
- Projects including this file are unable to export XLIFFs in Xcode 6.3 and up. HOT 2
- Push to Cocoapods Trunk HOT 7
- French localization should be improved
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nsdate-timeago.