First time trying to contribute, hopefully this is the proper channel to submit.
I propose an addition to the guard let statement to allow for replacement of
optionals with unwrapped values.
ex)
two current options
obj.methodWithCallback() {(foo, bar) in
guard let foo = foo else {
return
}
foo.prop = “new”
}
OR
obj.methodWithCallback() {(foo, bar) in
guard foo != nil else {
return
}
foo!.prop = “new”
}
I propose the following option:
obj.methodWithCallback() {(foo, bar) in
guard foo else {
return
}
foo.prop = “new”
}
This reduces the seemingly redundant "guard let foo = foo” statement and
removes the unnecessary forced optional unwrapping.
- Justin
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution