(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
extension Collection { | |
func eachConsecutive(_ size: Int) -> Array<SubSequence> { | |
let droppedIndices = indices.dropFirst(size - 1) | |
return zip(indices, droppedIndices) | |
.map { return self[$0...$1] } | |
} | |
} |
Based on some source I don't exactly remember right now but will add a link to later.
// When used on instances, allows changing fields directly using keypaths (handy way to avoid 'lazy var' property closures!)
let label
= UILabel()
.with(\.text, setTo: "Hello!")
.with(\.textColor, setTo: UIColor.darkGray)