Swift Guard statement should have default behavior
| Originator: | amcknight2718 | ||
| Number: | rdar://21478116 | Date Originated: | 21-Jun-2015 04:32 PM |
| Status: | Behaves as expected | Resolved: | No |
| Product: | iOS SDK | Product Version: | 9.0 |
| Classification: | Enhancement | Reproducible: | N/A |
The majority of times I use a guard statement, it's to return early from a function if the condition isn't met. Instead of always writing this:
guard someCondition else { return }
guard should have return as default behavior if no else clause is specified. So this would result in a return from the function:
guard someCondition
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!