ios - Integration Objective C Protocols with Swift -


I'm new to fast and I need some help to integrate a component AP PictureView (written in Objective-C). Link to the component:

But I have no success, because there is a protocol: AKPickerViewDelegate that do not work in swift:

  @ Square AKPickerView; @protocol AKPickerViewDelegate & lt; NSObject & gt; @optional - (NSString *) pickerView: (AKPickerView *) PickView title forItem: (NSInteger) item; - (NSUIENTER) Number of items input list: (Acquisitionview *) Procedure; - (Zero) PickView: (Ekpereviewview *) PickViews selected: Item (NSInteger) item; In SWIFT I wrote this code:  
  View category Controller: UIViewController, AKPickerViewDelegate {var pickerView: AKPickerView = AKPickerView () var Title: NSArray = ["Jeniro", "Faviriro", "Marso  

And I have implemented this method:

  Function number of items inappropriateview 'S PictureView!) - & gt; Int {return self.titles.count} func pickerView (pickerView: AKPickerView, titleForItem item: NSInteger) - & gt; NSString {return SoftTitles [Item] as NSString}  

but the compiler shows this error:

  corresponds to type 'ViewController' protocol No, A's PictureViewdelete ' 

Thank you for some help!

I need the method seen in the link AKPickerViewDelegate .

  @protocol AKPickerViewDelegate & lt; NSObject & gt; @required - (NSUInteger) numberOfItemsInPickerView: (AKPickerView *) PickView; - (NSString *) PickView: (AKPickerView *) PickerWeight Title ForItem: (NSInteger) Item; @ Option - (zero) PickerView: (AcquisitionView *) PickViewed Selection ITM: (NSINTGAR) Item; @end  

So fast you need to implement them. Apply these methods as below and remove this error

  func numberOfItemsInPickerView (pickerView: AKPickerView!) - & gt; UInt {return self.titles.count} func pickerView (pickerView: AKPickerView !, Title ForItem Item: Int) - & gt; String! {Return self.titles [item]}  

Note You have to add them to the bridging headers. Just type it #import "AKPickerView.h" in swift-bridging-header h


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -