- What is your evaluation of the proposal?
-1. In my opinion this problem can be solved by better code formatting.
This proposal just replaces ()
with {}
and removes the ,
between closures.
Below I have listed all samples from the proposal, and in my mind the current syntax and the proposed syntax are equally readable and usable.
UIView.anmiate sample:
before:
UIView.animate(withDuration: 0.7, delay: 1.0, options: .curveEaseOut,
animations: {
self.view.layoutIfNeeded()
},
completion: { finished in
print("Basket doors opened!")
}
)
after:
UIView.animate(withDuration: 0.7, delay: 1.0, options: .curveEaseOut) {
animations: {
self.view.layoutIfNeeded()
}
completion: { finished in
print("Basket doors opened!")
}
}
toggle sample:
before:
func toggle() {
UIView.animate(withDuration: 1,
animations: {
self.myView.backgroundColor = UIColor.green
self.myView.frame.size.width += 50
self.myView.frame.size.height += 20
self.myView.center.x += 20
},
completion: { _ in
UIView.animate(withDuration: 1, delay: 0.25, options: [.autoreverse, .repeat],
animations: {
self.myView.frame.origin.y -= 20
}
)
}
)
}
after:
func toggle() {
UIView.animate(withDuration: 1) {
animations: {
self.myView.backgroundColor = UIColor.green
self.myView.frame.size.width += 50
self.myView.frame.size.height += 20
self.myView.center.x += 20
}
completion: { _ in
UIView.animate(withDuration: 1, delay: 0.25, options: [.autoreverse, .repeat]) {
animations: {
self.myView.frame.origin.y -= 20
}
}
}
}
}
Button sample:
before:
Button(
action: {
...
...
},
label: {
Text("Hello!")
}
)
after:
Button {
action: {
...
...
}
label: {
Text("Hello!")
}
}
when sample:
before:
when(2 < 3,
then: {
...
...
},
else: {
...
...
}
)
after:
when(2 < 3) {
then: {
...
...
}
else: {
...
...
}
}
- Is the problem being addressed significant enough to warrant a change to Swift?
No.
- Does this proposal fit well with the feel and direction of Swift?
No
- If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
N/A
- How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
Read the pitch and the proposal.