Swift源码简介
- Swift于2015年正式开源,github地址:https://github.com/apple/swift
- 几个可能会经常看的目录
- docs:一些文档
- stdlib:Swift源码
- lib:C++源码
- include:C++头文件
- 标准库源码位置:https://github.com/apple/swift/tree/master/stdlib/public/core
Array分析
-
map、filter
-
https://github.com/apple/swift/blob/master/stdlib/public/core/Sequence.swift
-
flatMap、compactMap、reduce
-
https://github.com/apple/swift/blob/master/stdlib/public/core/SequenceAlgorithms.swift
Substring分析
- append、lowercased、uppercased
- https://github.com/apple/swift/blob/master/stdlib/public/core/Substring.swift
Optional分析
- map、flatMap、==、??
- https://github.com/apple/swift/b