6 ms·
This is my personal gripe with Swift. Theres just so many different ways to form expressions and do control flow. It just feels like code golf to me. for cas
by overcyn 9y ago
This is my personal gripe with Swift. Theres just so many different ways to form expressions and do control flow. It just feels like code golf to me.
for case let (title?, kind) in mediaList.map({ ($0.title, $0.kind) }) where title.hasPrefix("Harry Potter") {
print(" - [\(kind)] \(title)")
}
http://alisoftware.github.io/swift/pattern-matching/2016/05/16/pattern-matching-4/ http://alisoftware.github.io/swift/pattern-matching/2016/05/...
- ricardobeat 9y agoI don't know Swift much, but can tell at first glance that you're mapping items from `mediaList` into (title, kind) tuples, filtering for missing titles and "Harry Potter". I guess it's more about being comfortable with functional programming patterns in general, than its syntax.