Is there any way to get the following working in Swift 3?
let button = UIButton().apply { $0.setImage(UIImage(named: \"UserLocation\"), for: .normal
I had the same issue and ended up solving it with an operator:
infix operator <-< : AssignmentPrecedence func <-<(left:T, right:(T)->()) -> T { right(left) return left } let myObject = UIButton() <-< { $0.isHidden = false }