Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

moonman239

Cancelled
Original poster
Mar 27, 2009
1,541
32
I'm an Objective-C developer who's decided to use Swift for another project. In Interface Builder, I've set up my view controller to be a delegate for a search bar. Now, I want to know how to make my view controller implement the search bar delegate protocol.

RESOLVED: A quick Google search revealed this article, which says that to implement a protocol, you just do this:
Code:
class ViewController:UIViewController,insert protocol name
{
}
 
I'm an Objective-C developer who's decided to use Swift for another project. In Interface Builder, I've set up my view controller to be a delegate for a search bar. Now, I want to know how to make my view controller implement the search bar delegate protocol.

RESOLVED: A quick Google search revealed this article, which says that to implement a protocol, you just do this:
Code:
class ViewController:UIViewController,insert protocol name
{
}

indeed
implement the required methods in your ViewController and pass the ViewController to the class containing the protocol keyword using prepareForSegue and segue.destinationViewController.delegate = self
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.