ios - Need to convert a swift snippet of code into Objective C -
i had use swift made code on: https://github.com/lourenco-marinho/actionbutton in objective-c project. couldn't convert following swift line objective-c:
actionbutton.action = { button in button.togglemenu() } p.s. there no reference of variable button before or after code
let me show how things defined:
actionbutton is: var actionbutton: actionbutton! , actionbutton nsobject class
action defined in actionbutton class as: var action: actionbuttonaction?
and actionbuttonaction is: typealias actionbuttonaction = (actionbutton) -> void defined globally in actionbutton class
pretty messy? well, still want understand/convert above swift statement objective-c. clearance may follow link above.
that block in objective c
actionbutton.action = ^(actionbutton * button){ [button togglemenu]; }; also,typealise converted objective c
typedef void(^actionbuttonaction)(actionbutton * button);
Comments
Post a Comment