| Work | https://keepers.photos |
| Live | https://en.wikipedia.org/wiki/Dunedin |
| Work | https://keepers.photos |
| Live | https://en.wikipedia.org/wiki/Dunedin |
Just came across the strangest Swift syntax that I did not know you could do:
extension SomeProtocol: where Self: SomeOtherProtocol {}
to add conformance to SomeOtherProtocol
It makes sense if you think about it, but I would expect:
extension SomeProtocol: SomeOtherProtocol {}
This is an engineer's reaction to the first verse of Leonard Cohen’s Hallelujah.
Last night, while watching the documentary "Hallelujah: Leonard Cohen, A Journey, A Song" on Netflix, I kept being struck by the first verse: "Now I've heard there was a secret cord / That David played, and it pleased the Lord / But you don't really care for music, do ya? / It goes like this, the fourth, the fifth / The minor fall, the major lift / The baffled king composing Hallelujah". 1/
When extending generic types, it’s super useful that Swift enables type constraints to be attached directly to methods, since that enables us to use a method’s generic parameter types when defining those constraints.
For example, here I’m extending SwiftUI’s Binding type with a transforming method that lets me bind a Set property as a Bool that reflects whether that Set contains a given value 👍
Just published my first Swift article of 2023! 🎉
This one is about how the content offset (or scroll position) of a SwiftUI ScrollView can be observed without requiring any UIKit bridging. Very useful when implementing things like collapsable headers, or when performing other kinds of scroll position-dependent operations 👍
https://www.swiftbysundell.com/articles/observing-swiftui-scrollview-content-offset