Swift’s “if case let” Syntax
Zoe Smith (via Jim Correia):
case let
immediately precedes the candidate pattern in both versions. However, when usingif case let
the value comes after the=
operator[…]
case let
is a shortcut so all subsequent associated values can be bound just by providing variable names.[…]
Add conditions to
if
andguard
using commas[…]
Iterate using
for
,where
and logical operators
See also: Swift Closures and Objective-C Blocks.
2 Comments RSS · Twitter
The existence of these “fucking___syntax.com” web sites is a testament to obscure and over-wrought syntactical design, and it's disheartening to witness their need in a shiny new language like Swift.