PostTime
PostTime对象可以告诉您从您提供的时间戳以来过去了多久。
安装
要使用CocoaPods将PostTime集成到您的Xcode项目中,请在您的Podfile中指定它:
source 'https://github.com/CocoaPods/Specs'
use_frameworks!
target '<Your Target Name>' do
pod 'PostTime'
end
然后,运行以下命令:
$ pod install
用法
您需要在swift文件中导入PostTime。
设备ID
此设备ID来自密钥链。
let postTime = PostTime(postDate: Date().timeIntervalSince1970 - 5.0)
print(postTime.howLongAgo())
// => 5 sec.
许可证
版权所有 2018 David Wu