iTofu/LCBannerView

Implementing this library in Swift 3

Opened this issue · 1 comments

hi,
can we implement this in swift?
I tried but could not get to load images from internet.

i added a UIView on storyboard and set its class to LCBannerView.

Then created outlet for the view as
@IBOutlet weak var lgAddBannerView: LCBannerView!

then on viewed load as below:

override func viewDidLoad() {
super.viewDidLoad()
self.lgAddBannerView.imageURLs = ["https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQUSaoTcU7EiRBKlB26__J_YhAXK5WUjffGO9lQZ5bHgJs5Boybzg",
"https://cdn.pixabay.com/photo/2016/05/04/15/52/cats-1371991_960_720.jpg", "http://image5.tuku.cn/wallpaper/Animal%20Wallpapers/5491_2560x1600.jpg"]
self.lgAddBannerView.currentPageIndicatorTintColor = UIColor.red
self.lgAddBannerView.pageIndicatorTintColor = UIColor.white
self.lgAddBannerView.pageDistance = 20
self.lgAddBannerView.frame = CGRect(x: 0, y:0, : width: screen width, height: 150)
}

But it dod not worked for me.
Is there any way to make it work with Swift 3?
Help would be appreciated.

Thanks

Here I Have A demo Project Which Solve your Issue in Swift
Swift 4 Xcode 9.1
Used - In a normal View and In collectionView multiple times

Note:
Need to call the banner view in DidAppear instead of willAppear or DidLoad

Have a look at below Code File
Link - https://github.com/RockinGarg/LCBannerView-Swift4.git