测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可证 | MIT |
发布日期最后发布日期 | 2016年12月 |
SwiftSwift版本 | 3.0 |
SPM支持SPM | ✗ |
由KeiTestLibTrunk维护。
// 1 hour 30 min
let interval = 1.hour + 30.minute // 5400.0
let min = interval.minuteInterval // 90.0
let hour = interval.hourInterval // 1.5
let yesterday = Yesterday.startDate
let now = Today.now
let minInterval = (now - yesterday).minuteInterval
let hourInterval = (now - yesterday).hourInterval
let now = NSDate()
let tenMinutesBefore = now - 10.minute
let twoHoursAfter = now + 2.hour
let month = now.month
let date1 = NSDate(timeIntervalSince1970: 0)
let date2 = NSDate()
if date1 < date2 {
print("asc")
} else if date1 > date2 {
print("desc")
} else {
print("same")
}
// Supported Operators : ==, !=, <, <=, >, >=
let now = Today.now
if now == KWeekday.Sunday {
// ...
}
if now == KMonth.March {
// ...
}
let hexString = "#03a9f4"
let color = UIColor(hexString: hexString)
let color2 = hexString.UIColorValue
if hexString.isHexColorString {
// ...
}
if let color = hexString.parseHexColorString() {
// ...
}
class AppDelegate: KApp {
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
setupCoreData(modelName: "Model Name")
// or
setupCoreData(modelName: "Model Name", storeType: NSSQLiteStoreType, useLightweightMigration: true)
return true
}
}
KTimeProfiler.start() // Required
// ...
KTimeProfiler.checkpoint()
// ...
KTimeProfiler.checkpoint("Create File")
// ...
KTimeProfiler.checkpoint("Save to DB")
// ...
KTimeProfiler.report(verbose: true)
// Verbose Report
// KTimeProfiler: application(_:didFinishLaunchingWithOptions:) in 0.801861s
// ==================================================
// Start 0
// Checkpoint 1 +0.100269
// Create File +0.301065
// Save to DB +0.200434
// End +0.200093
// ==================================================
// total 0.801861
// ==================================================
let url = NSURL(fileURLWithPath: ...)
// read only
url.name
url.exist
url.isDirectory
url.fileSize
url.creationDate
url.lastAccessDate
url.modificationDate
// read/write
url.hidden
url.excludedFromBackup
url.excludedFromBackup = true
// or
url.addSkipBackupAttribute()
// or
NSFileManager.defaultManager().addSkipBackupAttributeToItemAtURL(url)
// or
do {
try url.addSkipBackupAttributeOrThrows()
// or
try NSFileManager.defaultManager().addSkipBackupAttributeToItemAtURLOrThrows(url)
} catch {}
iOS 8或更高版本
KeiSwiftFramework可通过CocoaPods获取。要安装它,只需将以下行添加到您的Podfile中
pod "KeiSwiftFramework"
Keun young Kim, [email protected]
KeiSwiftFramework可在MIT许可证下获取。有关更多信息,请参阅LICENSE文件。