Skip to content

Commit d2e74a5

Browse files
committed
Show multiple optional binding
1 parent 3862b3b commit d2e74a5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

README.markdown

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,19 +401,23 @@ For optional binding, shadow the original name when appropriate rather than usin
401401
**Preferred:**
402402
```swift
403403
var subview: UIView?
404+
var volume: Double?
404405

405406
// later on...
406-
if let subview = subview {
407-
// do something with unwrapped subview
407+
if let subview = subview, volume = volume {
408+
// do something with unwrapped subview and volume
408409
}
409410
```
410411

411412
**Not Preferred:**
412413
```swift
413414
var optionalSubview: UIView?
415+
var volume: Double?
414416

415417
if let unwrappedSubview = optionalSubview {
416-
// do something with unwrappedSubview
418+
if let realVolume = volume {
419+
// do something with unwrappedSubview and realVolume
420+
}
417421
}
418422
```
419423

0 commit comments

Comments
 (0)