EasyIOS-Swift 2.0.1

EasyIOS-Swift 2.0.1

测试已测试
语言语言 CC
许可证 MIT
发布最后发布2015年10月

zhuchao 维护。



 
依赖关系
HanekeSwift>= 0
Bond>= 0
Alamofire>= 0
SnapKit>= 0
Kingfisher>= 0
ObjectMapper>= 0
ReachabilitySwift>= 0
TTTAttributedLabel>= 0
 

image

EasyIOS For Swift

星号是支持 EasyIOS 的最佳方式!

DEMO 视频

ScreenShot

功能特性

  • MVVM : 受启发于 功能响应式编程Model-View-ViewModel
  • HTML 转 原生 : 将 HTML & CSS 转换为原生控件
  • 数据绑定 : 我们可以通过 Swift 使用 SwiftBond 绑定数据,并通过 HTML 使用 EZViewModel 绑定数据。例如 {{title}}
  • 反射 Cocoa Touch : 反射所有 Cocoa Touch Api,我们可以通过 HTML 使用 Cocoa Touch Api
  • 自动布局 : 基于 AutoLayout 的 HTML 布局
  • 实时加载 : 编辑 HTML,模拟器中的视图将自动更新,无需重新构建您的应用
  • 加密 HTML : 为了使 HTML 更加安全,我们提供了 AES 加密 来加密 HTML
  • URLManager : 通过自定义 URL 推送或显示控制器
  • 优雅的 PullToRefresh : 通过 HTML 添加 PullToRefresh 或 InfiniteScrolling

HTML 转 原生

  • 带有 PullReflash 的 UITableView
    • alignmargin 用于控制 UIView 的 AutoLayout
    • pull-to-refresh="handlePullRefresh."infinite-scrolling="handleInfinite. PullFooter" 用于添加 PullRefresh 或 InfiniteScrolling
    • handlePullRefresh. 通过 func handlePullRefresh (tableView:UITableView) 处理事件,您可以根据自己的需求定义它。
    • PullFooter 可加载自定义的 PullReflashView

<body>
    <div id="tableview" align="64 0 0 0" content-inset="{0,0,0,0}" type="UITableView"  estimated-row-height="100"  separator-style="None" pull-to-refresh="handlePullRefresh." infinite-scrolling="handleInfinite. PullFooter">
        <div align="0 0 0 0" type="cell" id="cell" >
            <img id="avatar" align="10 10 -10 *" clips-to-bounds="YES" width="45" height="45" layer_corner-radius="5" src="{{srcUrl}}" />
            <span align="top:2 avatar;right:-10" margin="left:12 avatar"  font="15 system" id="title">{{title}}</span>
            <span align="bottom:0 avatar;right:-10" margin="left:12 avatar" font="13 system" text-color="#ACACAC" id="subTitle" style="color:#ACACAC;" link-style="color:green;" >{{subTitle}}</span>
        </div>
        <div type="section" id="bgView" background-color="#F2F1F6" >
            <span align="left:15;center-y:0" font="14 system">{{title}}</span>
        </div>
    </div>
</body>
  • 使用 CSS 的 UIScrollView
    • 例如使用 @ 的 CSS,例如 @contentAlign

<style>
    .contentAlign{
    edge:0 0 0 0;left:0 root;right:0 root;
    }
    .inputStyle{
    font-size:15;color:#999999;
    }
</style>
<body>
    <div align="0 0 0 0" type="UIScrollView" background-color="#F3F3F3">
        <div align="@contentAlign">
            <img id="logo" image="login-logo" user-interaction-enabled="YES" present="demo://login" align="center-x:0;top:110;"/>
            <div id="username" layer_corner-radius="8" background-color="white" align="* 15 * -15" margin="top:30 logo" height="45">
                <input class="userTextField" id="userTextField" align="edge:10 10 -10 -10;" placeholder-style="@inputStyle" keyboard-type="EmailAddress" style="@inputStyle" placeholder="上面的logo可以被点击"/>
            </div>
            <div id="password" layer_corner-radius="8" background-color="white" align="* 15 * -15" margin="top:13 username" height="45">
                <input id="passwordTextField" secure-text-entry="YES" align="10 10 -10 -10" placeholder="密码" placeholder-style="@inputStyle" style="@inputStyle" />
            </div>
            <button id="submit" style="color:white;font-size:20;" background-color="#3FBCFB" align="* 15 -10 -15" margin="top:25 password" height="45" layer_corner-radius="8" onEvent="touch-up-inside:login">登陆</button>
        </div>
    </div>
</body>
  • HTML 标签和可重用的 html
    • @import(LabelHtml) 导入 LabelHtml.xml
    • 当 span 设置了 style="color:#ACACAC;font-size:18px;" 属性时,我们可以在 span 标签内使用原始 HTML

<style>
    <!--支持css 样式设置,html中利用@的方式进行调用-->
    .contentAlign{
        edge:0 0 0 0;left:0 root;right:0 root;
    }
</style>

<body>
    <div align="0 0 0 0" type="UIScrollView" background-color="#F3F3F3">
        <div align="@contentAlign">
            <!--span标签设置了style属性则启用富文本模式,span内部可以支持原生HTML的所有属性,具体请看LabelHtml.xml文件-->
            <span align="64 0 0 0" style="color:#ACACAC;font-size:18px;" link-style="color:green;" number-of-lines="0">
                <!--import the xml -->
                    @import(LabelHtml)
            </span>
        </div>
    </div>
</body>
  • 使用 FlowLayout 的 UICollectionView
<body>
    <div id="collectionView" align="0 0 0 0" type="UICollectionView" flow-layout="scroll-direction:Vertical;item-size:{300,50};section-inset:{3,3,0,3};minimum-interitem-spacing:3;minimum-line-spacing:3" content-inset="{64,0,0,0}" background-color="white" pull-to-refresh="handlePullRefresh." infinite-scrolling="handleInfinite.">
        <div align="0 0 0 0" type="cell"  id="cell"  background-color="red">
            <span align="10 10 -10 -10" font="10 system">{{name}}</span>
        </div>
    </div>
</body>

MVVM

基于 Swift 绑定框架 SwiftBond 的 MVVM

Bond 是一个 Swift 绑定框架,将绑定概念提升到了一个新的水平 - 简化到仅仅一个操作符。它简单、强大、类型安全且多范式 - 就像 Swift 一样。

使用方法

要运行示例项目,首先克隆仓库,然后从 Demo 目录运行 pod install

要求

  • Swift
  • iOS8

安装

EasyIOS-Swift 通过 CocoaPods 提供。要安装,只需将以下行添加到您的 Podfile 中

platform :ios, '8.0'
use_frameworks!
pod "EasyIOS-Swift"

导入 EasyIOS

import EasyIOS

作者

朱超,[email protected]

许可证

EasyIOS-Swift 可在 MIT 许可下使用。有关更多信息,请参阅 LICENSE 文件。