一套有用的 iOS 工具。
将 Utensils 添加到您的项目
CocoaPods
CocoaPods 是向您的项目添加 Utensils 的推荐方式。
- 将 Utensils 添加到您的 Podfile 中
pod 'Utensils'
。 - 通过运行
pod install
来安装 pod(s)。 - 使用
import Utensils
将 Utensils 添加到您的文件中。
Swift 包管理器
Swift 包管理器可以用来将Utensils
添加到您的项目中
- 添加
.package(url: "https://github.com/rbaumbach/Utensils", from: "0.1.0")
- 按照说明添加 Utensils 包到您的项目中。
从 Github 复制
- 从 github 复制仓库并直接复制文件,或者将它添加为 git 子模块。
- 将
源
目录下的所有文件添加到您的项目中。
使用哪些工具?
防抖动器(Debouncer)
let debouncer = Debouncer()
debouncer.mainDebounce(seconds: 0.1) {
thingy.doExpensiveWork()
}
目录(Directory)
let directory = Directory(.temp(additionalPath: "filez/"))
- 持久化工具名为
Trunk
let trunk = Trunk()
trunk.save(data: [0, 1, 2, 3, 4])
let arrayOfInts: [Int]? = trunk.load()
AppLaunchViewController
使用默认启动视图
let appLaunchViewController = AppLaunchViewController { print("I'm launching!") }
使用用户提供的自定义视图
let appLaunchViewController = AppLaunchViewController { thingy.doSomethingLengthyBeforeAppLaunches() }
appLaunchViewController.customLoadingView = fancyBrandedLoadingView
注意:自定义视图将锚定到视图控制器的所有四个角落
- 通用的
Validator
let email = Email(string: "[email protected]")
let isValidEmail = AnyValidator<Email>().isValid(email)
还有更多...
附加功能
所有工具都将包含相应的协议和仿制品,以供喜欢测试您软件的您使用。这允许您将应用程序编程到这个“接口”上,然后您可以将其用您自己的仿制品进行老化以进行单元测试。
测试
此项目已设置为使用 fastlane 来运行规范。
首先,打包所需的宝石,安装Cocoapods。然后,在根项目目录下运行
$ bundle
$ bundle exec pod install
接下来,使用fastlane在命令行上运行所有规格
$ bundle exec fastlane specs
建议、请求和反馈
感谢您查看Utensils。任何反馈、建议都可以发送到: [email protected],或者以github问题的形式提出。