I tried to implement iCarousel as per this tutorial: https://medium.com/@arb1nsnmgl/icarousel-walkthrough-swift-3-0-887554155242 but when trying to implement the @protocol it gives me 4 error messages:
- Expected '{' in protocol type
- Expected an attribute name
- Protocol 'iCarouselDataSource' cannot be nested inside another declaration
- Protocols do not allow generic parameters; use associated types instead
Currently the code looks like this:
import UIKit
class ViewController: UIViewController {
@IBOutlet var carouselView: iCarousel!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
//Testing
@protocol iCarouselDataSource <NSObject>
-(NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel;
-(UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(nullable UIView *)view;
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}