switch case let ... as
Swift โฉ Pattern Matching โฉ Sentence Patterns โฉ
๐ ๆฏ่ผ๏ผ if let ... as?
// switch on "protocol type"
switch medium {
case let b as Book : // ... โญ๏ธ ๆณจๆ๏ผ้่ฃก็จ็ๆฏ `as` ไธๆฏ `as?`
case let m as Movie: // ...
default: // ...
}
Last updated
Was this helpful?