March 2017
Intermediate to advanced
226 pages
5h 13m
English
There’s a dedicated movement of Swift coders who prefer to add constant and variable declarations at the end of a type implementation rather than the start. Here’s an example from the Swift standard library. It’s a fairly long example that highlights a subtle declaration layout style. Look at the two internal let declarations at the end of this structure:
| | public struct Zip2Sequence< |
| | Sequence1 : Sequence, Sequence2 : Sequence> |
| | : Sequence { |
| | |
| | public typealias Stream1 = Sequence1.Iterator |
| | public typealias Stream2 = Sequence2.Iterator |
| | |
| | /// A type whose instances can produce the elements of this |
| | /// sequence, in order. |
| | public typealias Iterator = Zip2Iterator ... |
Read now
Unlock full access