switch case is ...
Swift ⟩ Pattern Matching ⟩ Sentence Patterns ⟩
👉 比較: if let ... as?, switch case let ... as
// switch on "protocol type"
switch medium {
  case is WebSite: // ⭐️ case is (without binding)
  default: // ...
}- AliSoftware ⟩ Pattern Matching 
- if let ... as? - use - as?.
- switch case let ... as - optional binding. 
Last updated
Was this helpful?