CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.

MLBannerView 1.1.1

MLBannerView 1.1.1

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Jul 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Roman Sorochak.



  • By
  • Roman Sorochak

BannerView

Simple Banner View that automatically scrolls.

English localization Arabic localization
Demo Demo

Contents

Requirements

  • iOS 8.0+
  • Xcode 8.0+
  • Swift 3.0+

Installation

Usage

To add BannerView you may set class to view as BannerView in storyboard or create it manually from code.

Setup banner view:

bannerView.setup(
  type: BannerViewScrollType.fromStart,
  timeForOneItem: 1,
  bannerItems: [
    BannerItem(image: UIImage(named: "banner_1")),
    BannerItem(image: UIImage(named: "banner_2")),
    BannerItem(image: UIImage(named: "banner_3"))
  ],
  delegate: self
)

BannerViewDelegate

BannerViewDelegate allows you to be notifed when banner scrolls to next item or when user clicks on item.

@objc public protocol BannerViewDelegate {
    
    @objc optional func bannerView(bannerView: BannerView, didScrollTo: BannerItem, with index: Int)
    
    @objc optional func bannerView(bannerView: BannerView, didSelectItem: BannerItem, with index: Int)
}

There are three possible scroll types

public enum BannerViewScrollType {
    case fromStart
    case reverse
    case alwaysForward
}
.fromStart .reverse .alwaysForward
Demo Demo Demo

BannerPageControl

You may access bannerPageControl through public property

bannerView.pageControl.color = UIColor.black
bannerView.pageControl.currentPageColor = UIColor.green

See more about localization

Localizable

TODO

  • Shifting of authomatically scrolling when user interacts
  • Ability to set cell (ability to set image asynchronous)

License

Reusable is released under the MIT license. See LICENSE for details.