StfalconFixturer
一种简单轻量级的将自动填充 fixture 添加到 UITextFields 的调试方法。
关于我们
需要 iOS 和 Android 应用,MVP 开发或原型?通过 [email protected] 联系我们。我们自 2009 年以来一直在开发软件,并且是该领域的知名专家。查看我们的 作品集 并了解 stfalcon-studio 的更多库。
下载
通过 Cocoapods 下载
pod 'StfalconFixturer', '0.1.0'
用法
- 创建一个包含 fixture 的 json 文件,如示例所示
[
{
"tag": "email",
"group": "account",
"values": [
"[email protected]",
"[email protected]",
"[email protected]"
]
},
{
"tag": "password",
"group": "account",
"values": [
"mypassword1",
"superpassword2",
"mysuperpassword3"
]
},
{
"tag": "city",
"values": [
"Kyiv, Ukraine",
"San Francisco, California"
]
}
]
这里
tag
表示 fixture 的类型。您可以根据需要指定任何类型。
values
是特定标签的 fixture 数组。
group
(可选)允许您实现自动填充。这意味着如果您为任何 fixture 字段选择编号为 #2 的 fixture,则该组中的所有其他字段将根据它们的标签自动填充编号为 #2 的 fixture。
- 在 AppDelegate 中指定您的 json 源文件名给 Fixturer
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
#if DEBUG
Fixturer.shared.specify(source: "fixtures")
#endif
return true
}
- 在 Interface Builder 中轻松指定特定
UITextField
的Fixture Tag
- 现在,在对
UITextField
控制器进行连续三次点击时,将会弹出一个包含所有可用构件的动作表单,这些构件根据UITextField
的标签进行匹配。
许可协议
Copyright 2018 stfalcon.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://apache.ac.cn/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.