WPFBannerView is simple Swift library for adding banner in your project. This project dependent on some popular libraries. They include iCarousel(OC library) Kingfisher etc.
- iOS 9.0+
- Swift 4.0+
The library provides two static convenient method to init your banner.
let banner = WPFBannerView.bannerView(frame: CGRect(), imageURLS: [urls], titles: [titles]?, placeholder: nil?, didSelect: { (bannerView, index) in
// To do something
}, didScroll: { (bannerView, index) in
// or nil
})
banner.pageControlDotColor = UIColor.xxx
banner.pageControlDotCurrentColor = UIColor.xxx
self.view.addSubview(banner)
and
let banner = WPFBannerView.bannerView(frame: CGRect(x: 10, y: 50, width: 320, height: 134), imageURLS: remoteImageURLS, titles: [], placeholder: nil, delegate: self)
banner.type = .coverFlow
self.view.addSubview(banner)
func bannerView(_ bannerView: WPFBannerView, didScrollItemTo index: Int) {}
func bannerView(_ bannerView: WPFBannerView, didSelectItemAt index: Int) {}
There are two way to use WPFBannerView in your project, or directly drag the WPFBannerView file into your project:
- using CocoaPods
- using Carthage
CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries in your projects. See the Get Started section for more details.
target 'target’ do
pod 'WPFBannerView'
end
Carthage is a lightweight dependency manager for Swift and Objective-C. It leverages CocoaTouch modules and is less invasive than CocoaPods.
To install with carthage, follow the instruction on Carthage
carthage needs the support of kingfisher
github "codewpf/WPFBannerView"
github "Kingfisher"
In the source files where you need to use the library, import the header file:
import WPFBannerView
Follow and contact me on Twitter or Sina Weibo. If you find an issue, just open a ticket. Pull requests are warmly welcome as well.
WPFBannerView is released under the MIT license. See LICENSE for details.