11# SwiftlyUI & UIKit Plus
2+ ** Infusing UIKit with SwiftUI Development Efficiency**
3+ Inject SwiftUI-like development efficiency into UIKit through chained syntax and modern API design. Develop with UIKit more concisely and efficiently while maintaining full control, achieving a "zero conversion cost" SwiftUI-like development experience.
4+
25** 为 UIKit 注入 SwiftUI 的开发效率**
36通过链式语法和现代化 API 设计,让 UIKit 开发更简洁高效,同时保持完整控制权,实现「零转换成本」的 SwiftUI 式开发体验。
47
58
6- ## 快速导航 🗺️ | Quick Navigation
7- - [ 安装指南 | Installation ] ( #安装指南 )
8- - [ 为什么选择 SwiftlyUI? ] ( #技术优势全景图 )
9- - [ 功能特性 | Features ] ( #功能特性 )
10- - [ 使用示例] ( #使用示例 )
9+ ## Quick | Navigation快速导航
10+ - [ Installation Guide | 安装指南 ] ( #安装指南 )
11+ - [ Why Choose SwiftlyUI? | 为什么选择 ] ( #技术优势全景图 )
12+ - [ Features | 功能特性 ] ( #功能特性 )
13+ - [ Usage Examples | 使用示例] ( #使用示例 )
1114
12- ## 安装指南 📦| Installation <a name =" 安装指南 " ></a >
15+ ## Installation Guide | 安装指南 <a name =" 安装指南 " ></a >
1316[ ![ CocoaPods] ( https://img.shields.io/cocoapods/v/SwiftlyUI )] ( https://cocoapods.org/pods/SwiftlyUI )
1417[ ![ SPM] ( https://img.shields.io/badge/SPM-supported-green )] ( https://swift.org/package-manager/ )
1518### CocoaPods
1619``` ruby
17- # 核心组件 | Core components
1820pod ' SwiftlyUI'
19- # 如果pod失败,请使用以下方式
21+ # Use if pod fails | 如果pod失败使用此方式
2022pod ' SwiftlyUI' , :git => ' https://github.com/CoderLineChan/SwiftlyUI.git' , :tag => ' 1.1.12'
2123```
2224
@@ -27,25 +29,32 @@ dependencies: [
2729 from : " 1.1.12" )
2830]
2931```
30- ### 推荐使用Swift Package Manager( SPM)方式导入
32+ ### Recommended Installation via SPM | 推荐使用SPM方式导入
3133Xcode -> File -> Add Package Dependencies... -> https://github.com/CoderLineChan/SwiftlyUI.git -> Add Package
3234
3335
3436
35- ## 为什么选择 SwiftlyUI? <a name =" 技术优势全景图 " ></a >
37+ ## Why Choose SwiftlyUI? <a name =" 技术优势全景图 " ></a >
3638✅ ** 渐进式迁移** 无需重写现有代码,可逐步改造 UIKit 项目
37-
39+
40+ ✅ ** Progressive Migration** Migrate existing code gradually without rewriting entire projects
41+
3842✅ ** Swift 原生支持** 专为 Swift 设计的链式语法,类型安全且 IDE 友好
39-
43+
44+ ✅ ** Native Swift Support** Designed for Swift with chain syntax, type safety and IDE friendliness
45+
4046✅ ** 完整 UIKit 能力** 保留底层控件操作能力,不引入额外抽象层
41-
47+
48+ ✅ ** Full UIKit Capabilities** Retain full underlying control capabilities, no extra abstraction layer
49+
4250✅ ** 企业级兼容** 支持 iOS 13+,完美适配存量项目
4351
52+ ✅ ** Enterprise Compatibility** Supports iOS 13+, perfectly adapts to existing projects
4453
45- ## 功能特性 ✨ | Features <a name =" 功能特性 " ></a >
54+ ## Features | 功能特性 <a name =" 功能特性 " ></a >
4655
47- ### 使用 @ resultBuilder 为 UIView和UIStackView容器增强
48- - 多容器嵌套完美复刻SwiftUI
56+ ### Enhanced Containers with @ resultBuilder for UIView and UIStackView
57+ - Perfect nested containers replicating SwiftUI | 多容器嵌套完美复刻SwiftUI
4958``` swift
5059ZStackView == UIView
5160HStackView == UIStackView
@@ -94,7 +103,7 @@ let zView = ZStackView {// == UIView
94103view.addSubview (zView)
95104```
96105
97- ### 链式语法:属性设置增强
106+ ### Chained Syntax: Property Setting Enhancement | 链式语法:属性设置增强
98107- 极简代码:比原生代码减少 60% 的冗余字符
99108- 内边距精准设置,支持单边/全局/横向/纵向
100109- 内置分割线系统,一行代码设置分割线,子视图增删/隐藏/显示时自动更新分隔线
@@ -166,7 +175,7 @@ UIView.animate(withDuration: 0.3, delay: 0, options: .curveEaseInOut) {
166175}
167176
168177```
169- ### 智能布局系统 Auto Layout :前置约束 + 自适应布局
178+ ### Pre-Parent Constraints | 智能布局系统 Auto Layout :父视图前约束 + 自适应布局
170179- 添加父控件前约束,打破相对布局限制
171180``` swift
172181let view = UIView ()
@@ -186,7 +195,7 @@ let view = UIView()
186195superView.addSubview (view)
187196```
188197
189- ### UIControl & UIButton 多状态增强
198+ ### UIControl & UIButton Multi-state Enhancement
190199- Action封装闭包,需要注意循环引用
191200``` swift
192201let contorl = UIControl ()
@@ -214,7 +223,7 @@ let button = UIButton()
214223 .onAction (target : self , action : {$0 .doSomething () })
215224```
216225
217- ### UITextView & UITextField:输入控件增强,比原生更易用的文本处理
226+ ### UITextView & UITextField:Enhanced Input Controls
218227- 一行代码实现 Placeholder
219228- Padding 精准设置内边距
220229- 控件事件简化监听文本变化
@@ -239,7 +248,7 @@ let textField = UITextField()
239248 .onEndEditing (onEndEditingAction)
240249```
241250
242- ### 使用示例 <a name =" 使用示例 " ></a >
251+ ### Usage Examples | 使用示例 <a name =" 使用示例 " ></a >
243252<p align =" center " >
244253<img src =" https://github.com/CoderLineChan/SwiftlyUI/blob/main/Example/SampleGraphs/SampleGraph_1.png " width =" 1000px " />
245254</p >
0 commit comments