You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code below works in Then 1.0.1 but doesn't work in 1.0.2.
func tempt(label: UILabel) {
label.text = "I💞Then"
}
let label1 = UILabel()
tempt(label1) // Works fine definitely
UILabel().then(tempt) // Error: Cannot convert value of type '(UILabel) -> ()' to expected argument type 'inout UILabel -> Void'
Adding inout keyword to the func resolves the error, but it brings another problem.
func temptInOut(inout label: UILabel) {
label.text = "I💞Then"
}
UILabel().then(temptInOut) // Works fine
let label2 = UILabel()
temptInOut(label2) // Error: Cannot convert value of type 'UILabel' to expected argument type 'inout UILabel'
temptInOut(&label2) // Another Error: Cannot pass immutable value as inout argument: 'label2' is a 'let' constant
To resolve all errors, I should write code as below.
var label3 = UILabel()
temptInOut(&label3) // Works fine but seems ugly.
I don't use neither var nor &...
Proposal
#18 is nice-to-have modification, but old-style method(without inout keyword) is also nice in some situations.
So why don't you implement another old-type method as (@noescape block: Self -> Void) -> Self ?
The text was updated successfully, but these errors were encountered:
Problem
The code below works in Then 1.0.1 but doesn't work in 1.0.2.
Adding
inout
keyword to the func resolves the error, but it brings another problem.To resolve all errors, I should write code as below.
I don't use neither
var
nor&
...Proposal
#18 is nice-to-have modification, but old-style method(without
inout
keyword) is also nice in some situations.So why don't you implement another old-type method as
(@noescape block: Self -> Void) -> Self
?The text was updated successfully, but these errors were encountered: