![Eureka: Elegant form builder in Swift](Eureka.jpg)
<p align="center">
<a href="https://travis-ci.org/xmartlabs/Eureka"><img src="https://travis-ci.org/xmartlabs/Eureka.svg?branch=master" alt="Build status" /></a>
<img src="https://img.shields.io/badge/platform-iOS-blue.svg?style=flat" alt="Platform iOS" />
<a href="https://developer.apple.com/swift"><img src="https://img.shields.io/badge/swift4-compatible-4BC51D.svg?style=flat" alt="Swift 4 compatible" /></a>
<a href="https://github.com/Carthage/Carthage"><img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" alt="Carthage compatible" /></a>
<a href="https://cocoapods.org/pods/Eureka"><img src="https://img.shields.io/cocoapods/v/Eureka.svg" alt="CocoaPods compatible" /></a>
<a href="https://raw.githubusercontent.com/xmartlabs/Eureka/master/LICENSE"><img src="http://img.shields.io/badge/license-MIT-blue.svg?style=flat" alt="License: MIT" /></a>
<a href="https://codebeat.co/projects/github-com-xmartlabs-eureka"><img alt="codebeat badge" src="https://codebeat.co/badges/16f29afb-f072-4633-9497-333c6eb71263" /></a>
</p>
Made with ❤️ by [XMARTLABS](http://xmartlabs.com). This is the re-creation of [XLForm] in Swift.
[简体中文](Documentation/README_CN.md)
## Overview
<table>
<tr>
<th>
<img src="Example/Media/EurekaExample1.gif" width="220"/>
</th>
<th>
<img src="Example/Media/EurekaExample2.gif" width="220"/>
</th>
<th>
<img src="Example/Media/EurekaExample3.gif" width="220"/>
</th>
</tr>
</table>
## Contents
* [Requirements]
* [Usage]
+ [How to create a Form]
+ [Getting row values]
+ [Operators]
+ [Using the callbacks]
+ [Section Header and Footer]
+ [Dynamically hide and show rows (or sections)]
+ [List sections]
+ [Multivalued sections]
+ [Validations]
+ [Swipe Actions]
* [Custom rows]
+ [Basic custom rows]
+ [Custom inline rows]
+ [Custom presenter rows]
* [Row catalog]
* [Installation]
* [FAQ]
**For more information look at [our blog post] that introduces *Eureka*.**
## Requirements
* Xcode 9.2+
* Swift 4+
### Example project
You can clone and run the Example project to see examples of most of Eureka's features.
<table>
<tr>
<th>
<img src="Example/Media/EurekaNavigation.gif" width="200"/>
</th>
<th>
<img src="Example/Media/EurekaRows.gif" width="200"/>
</th>
</tr>
</table>
## Usage
### How to create a form
By extending `FormViewController` you can then simply add sections and rows to the `form` variable.
```swift
import Eureka
class MyFormViewController: FormViewController {
override func viewDidLoad() {
super.viewDidLoad()
form +++ Section("Section1")
<<< TextRow(){ row in
row.title = "Text Row"
row.placeholder = "Enter text here"
}
<<< PhoneRow(){
$0.title = "Phone Row"
$0.placeholder = "And numbers here"
}
+++ Section("Section2")
<<< DateRow(){
$0.title = "Date Row"
$0.value = Date(timeIntervalSinceReferenceDate: 0)
}
}
}
```
In the example we create two sections with standard rows, the result is this:
<center>
<img src="Example/Media/EurekaHowTo.gif" width="200" alt="Screenshot of Custom Cells"/>
</center>
You could create a form by just setting up the `form` property by yourself without extending from `FormViewController` but this method is typically more convenient.
#### Configuring the keyboard navigation accesory
To change the behaviour of this you should set the navigation options of your controller. The `FormViewController` has a `navigationOptions` variable which is an enum and can have one or more of the following values:
- **disabled**: no view at all
- **enabled**: enable view at the bottom
- **stopDisabledRow**: if the navigation should stop when the next row is disabled
- **skipCanNotBecomeFirstResponderRow**: if the navigation should skip the rows that return false to `canBecomeFirstResponder()`
The default value is `enabled & skipCanNotBecomeFirstResponderRow`
To enable smooth scrolling to off-screen rows, enable it via the `animateScroll` property. By default, the `FormViewController` jumps immediately between rows when the user hits the next or previous buttons in the keyboard navigation accesory, including when the next row is off screen.
To set the amount of space between the keyboard and the highlighted row following a navigation event, set the `rowKeyboardSpacing` property. By default, when the form scrolls to an offscreen view no space will be left between the top of the keyboard and the bottom of the row.
```swift
class MyFormViewController: FormViewController {
override func viewDidLoad() {
super.viewDidLoad()
form = ...
// Enables the navigation accessory and stops navigation when a disabled row is encountered
navigationOptions = RowNavigationOptions.Enabled.union(.StopDisabledRow)
// Enables smooth scrolling on navigation to off-screen rows
animateScroll = true
// Leaves 20pt of space between the keyboard and the highlighted row after scrolling to an off screen row
rowKeyboardSpacing = 20
}
}
```
If you want to change the whole navigation accessory view, you will have to override the `navigationAccessoryView` variable in your subclass of `FormViewController`.
### Getting row values
The `Row` object holds a ***value*** of a specific type.
For example, a `SwitchRow` holds a `Bool` value, while a `TextRow` holds a `String` value.
```swift
// Get the value of a single row
let row: TextRow? = form.rowBy(tag: "MyRowTag")
let value = row.value
// Get the value of all rows which have a Tag assigned
// The dictionary contains the 'rowTag':value pairs.
let valuesDictionary = form.values()
```
### Operators
Eureka includes custom operators to make form creation easy:
#### +++ Add a section
```swift
form +++ Section()
// Chain it to add multiple Sections
form +++ Section("First Section") +++ Section("Another Section")
// Or use it with rows and get a blank section for free
form +++ TextRow()
+++ TextRow() // Each row will be on a separate section
```
#### <<< Insert a row
```swift
form +++ Section()
<<< TextRow()
<<< DateRow()
// Or implicitly create the Section
form +++ TextRow()
<<< DateRow()
```
#### += Append an array
```swift
// Append Sections into a Form
form += [Section("A"), Section("B"), Section("C")]
// Append Rows into a Section
section += [TextRow(), DateRow()]
```
### Using the callbacks
Eureka includes callbacks to change the appearance and behavior of a row.
#### Understanding Row and Cell
A `Row` is an abstraction Eureka uses which holds a **value** and contains the view `Cell`. The `Cell` manages the view and subclasses `UITableViewCell`.
Here is an example:
```swift
let row = SwitchRow("SwitchRow") { row in // initializer
row.title = "The title"
}.onChange { row in
row.title = (row.value ?? false) ? "The title expands when on" : "The title"
row.updateCell()
}.cellSetup { cell, row in
cell.backgroundColor = .lightGray
}.cellUpdate { cell, row in
cell.textLabel?.font = .italicSystemFont(ofSize: 18.0)
}
```
<img src="Example/Media/EurekaOnChange.gif" width="300" alt="Screenshot of Disabled Row"/>
#### Callbacks list
* **onChange()**
Called when the value of a row changes. You might be interested in adjusting some parameters here or even make some other rows appear or disappear.
* **onCellSelection()**
Called each time the user taps on the row and it gets selected.
* **cellSetup()**
Called only once when the c
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
软件开发设计:PHP、QT、应用软件开发、系统软件开发、移动应用开发、网站开发C++、Java、python、web、C#等语言的项目开发与学习资料 硬件与设备:单片机、EDA、proteus、RTOS、包括计算机硬件、服务器、网络设备、存储设备、移动设备等 操作系统:LInux、IOS、树莓派、安卓开发、微机操作系统、网络操作系统、分布式操作系统等。此外,还有嵌入式操作系统、智能操作系统等。 网络与通信:数据传输、信号处理、网络协议、网络与通信硬件、网络安全网络与通信是一个非常广泛的领域,它涉及到计算机科学、电子工程、数学等多个学科的知识。 云计算与大数据:数据集、包括云计算平台、大数据分析、人工智能、机器学习等,云计算是一种基于互联网的计算方式,通过这种方式,共享的软硬件资源和信息可以按需提供给计算机和其他设备。
资源推荐
资源详情
资源评论
收起资源包目录
支持系统小组件开关SS.zip (1547个子文件)
CLI.1 3KB
libsodium-iOS.a 2MB
libsodium-macOS.a 1.68MB
PushNotificationPayload.apns 867B
LumberjackUser.bash 1KB
bootstrap 105B
bootstrap 97B
bootstrap-if-needed 93B
bootstrap-if-needed 93B
mib2.c 103KB
maxminddb.c 70KB
sockets.c 68KB
dhcp.c 63KB
tcp_in.c 59KB
ppp.c 57KB
lcp.c 56KB
tcp.c 52KB
etharp.c 51KB
tcp_out.c 49KB
api_msg.c 45KB
msg_in.c 43KB
pbuf.c 38KB
ipcp.c 38KB
auth.c 35KB
udp.c 33KB
ppp_oe.c 33KB
ip.c 32KB
dns.c 30KB
mib_structs.c 29KB
ip_frag.c 28KB
igmp.c 26KB
chap.c 24KB
api_lib.c 23KB
fsm.c 23KB
mem.c 23KB
netif.c 22KB
msg_out.c 21KB
vj.c 18KB
autoip.c 18KB
asn1_dec.c 16KB
pap.c 16KB
slipif.c 14KB
tcpip.c 14KB
asn1_enc.c 14KB
init.c 14KB
memp.c 13KB
timers.c 13KB
inet_chksum.c 13KB
md5.c 11KB
chpms.c 11KB
icmp.c 11KB
ip6.c 11KB
netdb.c 11KB
raw.c 10KB
ethernetif.c 9KB
ip_addr.c 8KB
randm.c 8KB
netbuf.c 7KB
stats.c 6KB
icmp6.c 6KB
netifapi.c 5KB
inet6.c 4KB
def.c 3KB
magic.c 3KB
err.c 3KB
ip6_addr.c 3KB
sys.c 2KB
inet.c 2KB
maxminddb_unions.c 429B
sys_arch.c 321B
compat.c 88B
Cartfile 285B
Cartfile 110B
uncrustify.cfg 17KB
CHANGELOG 134KB
NEKitRule.conf 3KB
COPYING 2KB
styles.css 419B
Benchmark iPad.csv 938B
Benchmark PowerMac.csv 938B
Benchmark iPodTouch3 GCD.csv 938B
Benchmark iPhone 3GS.csv 938B
Benchmark iMac.csv 938B
Dangerfile 6KB
elements 15KB
PacketTunnel.entitlements 610B
BearSS.entitlements 598B
freeWidget.entitlements 598B
macOSSwiftIntegration.entitlements 322B
FILES 1KB
FILES 494B
FILES 142B
Gemfile 107B
Gemfile 107B
Gemfile 76B
Gemfile 67B
Gemfile 58B
EurekaExample2.gif 4.6MB
EurekaRows.gif 3.58MB
EurekaExample1.gif 2.68MB
共 1547 条
- 1
- 2
- 3
- 4
- 5
- 6
- 16
资源评论
妄北y
- 粉丝: 1w+
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- cc test for cc
- 蚁群算法基于matlab实现,有源代码,和详细的说明文件,matlab仿真的数据及参数输入的值都一给定好
- 20231201HlBwnVr1.zip
- 基于py+matlab MATLAB实时数字图像相关软件用于监测在康奈尔高能同步加速器上进行的原位机械加载高能x射线衍射
- 基于matlab实现字符识别的参考程序,用所用的字体识别率挺高,部分手写的也能识别,但是还不能识别扭曲和倾斜的字符 .rar
- 基于matlab实现指纹识别系统 包括数据库导入、图像选择识别、帮助功能、识别图像可视、gabor滤波可视,实现界面操作.rar
- 基于matlab实现指纹识别,利用gabor滤波器,提取指纹特征,只能呢读取bmp图像.rar
- 基于matlab实现于数字图像相关方法中散斑质量评价
- 基于matlab实现遗传算法和佳点集遗传算法的基本思想和不同点,用遗传算法测试一标准函数 佳点集算法测试一标准函数
- tensorflow-gpu-2.5.1-cp38-cp38-manylinux2010-x86-64.whl
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功