TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Dec 2016 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by 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 or higher
KeiSwiftFramework is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "KeiSwiftFramework"
Keun young Kim, [email protected]
KeiSwiftFramework is available under the MIT license. See the LICENSE file for more info.