Forked from christianselig/swift-existentials.swift
          
        
    
          Last active
          October 9, 2024 20:17 
        
      - 
      
- 
        Save aoberoi/ecb57b2a8d196080d2c525622a5a863e to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | protocol P { | |
| } | |
| struct Q: P {} | |
| struct MyWrapper { | |
| let key: String | |
| let value: any P | |
| } | |
| let point: Q? = nil | |
| // 🛑 Value of optional type 'Q?' must be unwrapped to a value of type 'Q' | |
| let wrapper = MyWrapper(key: "point", value: point) | |
| if wrapper.value == nil { | |
| print("nil value") | |
| } else { | |
| print("continue…") | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment