DevModeKit 0.3.3

DevModeKit 0.3.3

测试已测试
Lang语言 SwiftSwift
许可证 MIT
发布最后发布2017年6月
SwiftSwift 版本3.1
SPM支持 SPM

Matt WakefieldJohn Bailey 维护。



  • Matthew Wakefield

一系列有用的 Swift 扩展和工具。

扩展

一系列有用的扩展。

日期扩展

许多额外的 Date 功能。

图片扩展

您是否希望能够更容易地从 URL 对象创建 UIImage?现在您做到了!

UIImage.load("http://cdn.devmode.com/assets/ben_bio-818b58fc249a9d19ba5a5ce436dd54e1.jpg") { img in
  ...
}

另外,您的 UIImage 在首次使用后将在本地进行缓存。

URL 扩展

轻松地将 URL 查询字符串解析成键值对的 Dictionary

let url = URL(string: "http://www.devmode.com?param1=value1&param2=value2&param3=value3")
url?.parsedQuery["param1"] // "value1"
url?.parsedQuery["param2"] // "value2"
url?.parsedQuery["param3"] // "value3"

工具

一系列有用的工具。

异步操作

异步任务的 Operation 子类。

loadingQueue = OperationQueue()
loadingQueue.maxConcurrentOperationCount = 2
loadingQueue.addOperation(AsynchronousOperation { done in
  ...
})

默认值

通过索引轻松检索和存储持久化的设备特定默认值。

Defaults.standard["KEY"] = "VALUE"
Defaults.standard["KEY"] as? String // "VALUE"

日志记录

您是否希望能在 Swift 中使用传统的日志记录机制?现在可以了!

Logger.log("Test", .warning, "Hello World!")
Logger.warning("Test", "Hello World!")

属性列表

您是否希望能够更轻松地与属性文件中的嵌套值进行交互?现在可以这样做了!

// Set a persistent environment to switch between property lists.
PropertyList.environment = .production

// Specify the `Bundle` to use to locate the property list.
PropertyList.bundle = Bundle(for: type(of: self))

// Use subscripts and dot-syntax to retrieve values from property list files.
PropertyList.main["Group.SubOne.Key"].string // <nested-value-from-property-list>