4 ms·
Does Swift has pattern matching and equivalent of Option/Result enums? I tried it casually but the documentation didn't feel great and things felt like they ass
by noisy_boy 4y ago
Does Swift has pattern matching and equivalent of Option/Result enums? I tried it casually but the documentation didn't feel great and things felt like they assumed familiarity with Apple's ecosystem.
- valleyer 4y agoPatterns: https://docs.swift.org/swift-book/documentation/the-swift-programming-language/patterns/ https://docs.swift.org/swift-book/documentation/the-swift-pr... Optionals: https://docs.swift.org/swift-book/documentation/the-swift-programming-language/thebasics#Optionals https://docs.swift.org/swift-book/documentation/the-swift-pr... Result: https://developer.apple.com/documentation/swift/result https://developer.apple.com/documentation/swift/result
- runeks 4y agoSwift also supports enumerations with associates values, which is super useful: https://docs.swift.org/swift-book/documentation/the-swift-programming-language/enumerations/#Associated-Values https://docs.swift.org/swift-book/documentation/the-swift-pr...
- noisy_boy 4y agoThanks for the links - I did the Swift Tour and the language has indeed come a long way since I tried it last time; quite expressive and nice to write in. Hopefully it gains traction in non-Apple circles as well.