I am Swift beginner and really stuck with this problem.
I have a prototype cell CurrencySwitchTableViewCell
that is subclass of UITableViewCell
.
class CurrencySwitchTableViewCell: UITableViewCell {
@IBOutlet weak internal var currencySwitchDelegate: AnyObject!
This cell has a currencySwitchDelegate
property that should be of CurrencySwitchDelegate
protocol
protocol CurrencySwitchDelegate {
func didSelectCurrency(currency:Currency)
}
How can I declare in CurrencySwitchTableViewCell
that my currencySwitchDelegate
is AnyObject
corresponding to CurrencySwitchDelegate
protocol?
What is Swift analog of Objective-C code like this?
NSObject<CurrencySwitchDelegate>
or id<CurrencySwitchDelegate>
P.S.
I know I can just declare my property to be
@IBOutlet weak internal var currencySwitchDelegate: CurrencySwitchDelegate!
But XCode gives me error with @IBOutlet
modifier (IBOutlets should be of AnyObject
class)