iCarousel in swift version 1.2 error (candidate is not Objc but protocol requires it)
iCarousel in swift version 1.2 error (candidate is not Objc but protocol requires it)
我在 swift 1.2 中收到以下错误:'RootViewController' 不符合协议 'iCarouselDataSource'
下面class,当我尝试实现第三方库iCarousel时:
class RootViewController: UIViewController,iCarouselDataSource,iCarouselDelegate
{...}
自动修复工具在此方法中放置一个符合协议的@objc 标记:
@objc func carousel(carousel: iCarousel!, viewForItemAtIndex index: Int, var reusingView view: UIView?) -> UIView?
{}
但随后出现另一个错误:Method cannot be marked @objc because the type of the parameter 3 cannot be represented in Objective-C
感谢任何帮助或线索,谢谢!
从 reusingView 中删除变量,例如:
func carousel(carousel: iCarousel!, viewForItemAtIndex index: Int, reusingView view: UIView!) -> UIView! {
var newView = view
if newView == nil {
//create new view
}
//update data
return newView
}
我在 swift 1.2 中收到以下错误:'RootViewController' 不符合协议 'iCarouselDataSource'
下面class,当我尝试实现第三方库iCarousel时:
class RootViewController: UIViewController,iCarouselDataSource,iCarouselDelegate
{...}
自动修复工具在此方法中放置一个符合协议的@objc 标记:
@objc func carousel(carousel: iCarousel!, viewForItemAtIndex index: Int, var reusingView view: UIView?) -> UIView?
{}
但随后出现另一个错误:Method cannot be marked @objc because the type of the parameter 3 cannot be represented in Objective-C
感谢任何帮助或线索,谢谢!
从 reusingView 中删除变量,例如:
func carousel(carousel: iCarousel!, viewForItemAtIndex index: Int, reusingView view: UIView!) -> UIView! {
var newView = view
if newView == nil {
//create new view
}
//update data
return newView
}