没有合适的资源?快使用搜索试试~ 我知道了~
首页objc.io - Advanced Swift_Swift 5.pdf
objc.io - Advanced Swift_Swift 5.pdf
需积分: 50 33 下载量 146 浏览量
更新于2023-03-03
评论 1
收藏 40.67MB PDF 举报
[MG] objc.io - Advanced Swift_Swift 5.pdf. 已经更新到 Swift5.
资源详情
资源评论
资源推荐
Version 4.0 (May 2019)
© 2019 Kugler und Eidhof GbR
All Rights Reserved
For more books, articles, and videos visit us at https://www.objc.io.
Email: mail@objc.io
Twitter: @objcio
1 Introduction 10
Who Is This Book For? 12
Themes 13
Terminology 16
Swift Style Guide 20
Revision History 22
2 Built-In Collections 24
Arrays 25
Arrays and Mutability 25
Array Indexing 27
Transforming Arrays 29
Array Slices 41
Dictionaries 43
Mutating Dictionaries 44
Some Useful Dictionary Methods 44
Hashable Requirement 46
Sets 47
Set Algebra 48
Index Sets and Character Sets 49
Using Sets Inside Closures 50
Ranges 51
Countable Ranges 52
Partial Ranges 53
Range Expressions 53
Recap 54
3 Optionals 56
Sentinel Values 57
Replacing Sentinel Values with Enums 59
A Tour of Optional Techniques 61
if let 61
while let 62
Doubly Nested Optionals 64
if var and while var 65
Scoping of Unwrapped Optionals 66
Optional Chaining 70
The nil-Coalescing Operator 73
Using Optionals with String Interpolation 75
Optional map 77
Optional atMap 79
Filtering Out nils with compactMap 80
Equating Optionals 81
Comparing Optionals 84
When to Force-Unwrap 84
Improving Force-Unwrap Error Messages 86
Asserting in Debug Builds 87
Implicitly Unwrapped Optionals 89
Implicit Optional Behavior 90
Recap 90
4 Functions 91
Overview 92
Flexibility through Functions 99
Functions as Data 103
Functions as Delegates 110
Delegates, Cocoa Style 110
Delegates That Work with Structs 111
Functions Instead of Delegates 113
inout Parameters and Mutating Methods 116
Nested Functions and inout 119
When & Doesn’t Mean inout 119
Properties 120
Change Observers 121
Lazy Stored Properties 123
Subscripts 125
Custom Subscripts 126
Advanced Subscripts 126
Key Paths 128
Key Paths Can Be Modeled with Functions 130
Writable Key Paths 131
The Key Path Hierarchy 134
Key Paths Compared to Objective-C 135
Future Directions 135
Autoclosures 135
The @escaping Annotation 138
withoutActuallyEscaping 140
Recap 141
5 Structs and Classes 142
Value Types and Reference Types 143
Mutation 147
Mutating Methods 151
inout Parameters 152
Lifecycle 153
Reference Cycles 153
Closures and Reference Cycles 158
Choosing between Unowned and Weak References 160
Deciding between Structs and Classes 161
Classes with Value Semantics 162
Structs with Reference Semantics 163
Copy-On-Write Optimization 165
Copy-On-Write Tradeoffs 166
Implementing Copy-On-Write 167
Recap 171
6 Enums 173
Overview 174
Enums Are Value Types 175
Sum Types and Product Types 177
Pattern Matching 179
Pattern Matching in Other Contexts 183
Designing with Enums 185
Switch Exhaustively 186
Make Illegal States Impossible 187
Use Enums for Modeling State 191
Choosing between Enums and Structs 195
Parallels between Enums and Protocols 197
Use Enums to Model Recursive Data Structures 200
Raw Values 206
The RawRepresentable Protocol 207
Manual RawRepresentable Conformance 208
RawRepresentable for Structs and Classes 209
Internal Representation of Raw Values 210
Enumerating Enum Cases 211
剩余430页未读,继续阅读
lyqflnh
- 粉丝: 2
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- stc12c5a60s2 例程
- Android通过全局变量传递数据
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0