Swift: allow flattening of "if let" construct for multiple variables
| Originator: | raphael | ||
| Number: | rdar://19027407 | Date Originated: | 19-Nov-2014 09:13 AM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode 6.1.1 |
| Classification: | Enhancement | Reproducible: | Not Applicable |
Currently, Swift requires that 2-level 'if let' constructs be used to test 2 variables. This doesn't scale well for multi variables, and requires using the non-let variant + unwrapping inside the if block.
Could you consider updating the 'if let' construct to handle multiple variables in a single block of code?
==== example ====
var str2 : String? = "test2"
var str3 : String? = "test3"
if let s2 = str2 {
if let s3 = str3 {
print(s2)
print(s3)
}
}
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!