DNTimeAndDay 0.2.1

DNTimeAndDay 0.2.1

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最近发布2016年10月
SPM支持 SPM

Daniel 比较.



  • dnomnom

DNTimeAndDay

对 NSDate/NSDateFormatter/NSDateComponent 的简单/快速实现。DNTimeAndDay 对象可以用字符串值、整数值或日期对象初始化。该对象以各种格式返回 stringValue 并更改给定间隔的时间和日期。目前只支持时间和星期几

安装

DNTimeAndDay 可通过 CocoaPods 获取。要安装它,只需将以下行添加到您的 Podfile

pod "DNTimeAndDay"

示例

要运行示例项目,克隆仓库:

git clone https://github.com/dknomura/DNTimeAndDay.git

然后从 Example 目录运行

pod install

用法

var currentTimeAndDay = DNTimeAndDay.currentTimeAndDay()  
// can also init with string and int values
// day string parameter is case insensitive and can recognize common day abbreviations, time string can have a period or colon and the option of am/pm (ie "11:30p", "11.5p", "11:00pm", "23.5", "23:30" are all the same) 
// default minuteInterval = 30, dayInterval = 1
var otherTimeAndDay = DNTimeAndDay.init(dayString: "m", timeString:"9p", minuteInterval: 90, dayInterval = 2)

otherTimeAndDay.increaseTime()  
otherTimeAndDay.time.stringValue(forFormat:.format12Hour)  // "10:30pm"
// if the time is in between intervals, then the minute will increase to match the interval. 
// ie time = 12:00pm, not 12;15pm

currentTimeAndDay.increaseDay() 
currentTimeAndDay.day.stringValue(forFormat:.abbr) // "Wed"

要求

  • iOS 9.3+
  • Xcode 7.3.1+

作者

dnomnom, [email protected]

许可证

DNTimeAndDay 可在 MIT 许可下使用。有关更多信息,请参阅 LICENSE 文件。