Convert the method signature to Swift

24 views
Skip to first unread message

Kien Weng Khaw

unread,
Jun 3, 2015, 6:14:40 AM6/3/15
to swift-l...@googlegroups.com
Hi,
I encounter problem when trying to convert the following method signature to Swift. It is actually the method that I need to implement for a protocol.

- (void)conversationListViewController:(ATLConversationListViewController *)conversationListViewController didSearchForText:(NSString *)searchText completion:(void (^)(NSSet *filteredParticipants))completion

May I know what is the equivalent of the Swift version?

Thanks. :-)

Jens Alfke

unread,
Jun 3, 2015, 5:29:14 PM6/3/15
to Kien Weng Khaw, swift-l...@googlegroups.com

On Jun 3, 2015, at 3:14 AM, Kien Weng Khaw <kwk...@gmail.com> wrote:

I encounter problem when trying to convert the following method signature to Swift. It is actually the method that I need to implement for a protocol.

Try command-clicking the protocol name in Xcode; it should open a window showing a Swift translation of its declaration.

I’m just typing this into Mail, but I think the translation would be:

func conversationListViewController(conversationListViewController: ATLConversationListViewController,
didSearchForText searchText: String,
completion: NSSet->( ) )

—Jens

Kien Weng Khaw

unread,
Jun 4, 2015, 7:19:12 AM6/4/15
to swift-l...@googlegroups.com, kwk...@gmail.com
Hi Jens,
Thanks for your reply.

Thanks for the tips of using command-clicking. I tried, but it does not work. I wonder if this only work for particular cases or should work all the time?
Try command-clicking the protocol name in Xcode; it should open a window showing a Swift translation of its declaration.

At the end, this works.

    func conversationListViewController(conversationListViewController: ATLConversationListViewController, didSearchForText searchText: String, completion: ((Set<NSObject>!) -> Void)?)

Thanks. :-)
Reply all
Reply to author
Forward
0 new messages