Giter VIP home page Giter VIP logo

lxgalleryview's Introduction

LXGalleryView

Xcode 9.0+ iOS 9.0+ Swift 4.0+ CocoaPods Compatible
Platform License

LXGalleryView is a customizable slideshow for custom cells.

Requirements

  • Swift 4+
  • iOS 9.0+
  • Xcode 9+

Installation

CocoaPods

You can use CocoaPods to install LXGalleryView by adding it to your Podfile:

pod 'LXGalleryView'

Usage

Create a 'LXGalleryView' Instance.

let frame = CGRect(x: 0, y: 0, width: self.view.bounds.width, height: 230)
let galleryView = LXGalleryView(frame: frame, delegate: self, dataSource: self)

self.view.addSubview(galleryView)

Register a custom cell to the LXGalleryView. Cell size automatically adjusts to 'LXGalleryView' bounds.

galleryView.galleryCollection.register(UINib(nibName: "myCustomCell", bundle: Bundle.main), forCellWithReuseIdentifier: "myCell")

Implement the 'LXGalleryViewDataSource' protocol.

@objc public protocol LXGalleryViewDataSource {
func galleryView(_ galleryView: LXGalleryView, numberOfItemsInSection section: Int) -> Int
func galleryView(_ galleryView: LXGalleryView, cellForItemAt: IndexPath) -> UICollectionViewCell
}

Additional methods, properties & delegate

Public Methods:

galleryView.setButtonImages(left: UIImage, right: UIImage, for state: UIControlState) // to set custom navigation buttons

Public Properties:

galleryView.galleryCollection: LXGalleryViewCollection // wrapped CarouselCollection (Subclass of UICollectionView)
galleryView.dataSource: LXGalleryDataSource // dataSource
galleryView.delegate: LXGalleryDelegate // delegate
galleryView.isAnimated: Bool // automatic scrolling
galleryView.duration: Double // duration until the next cell should animate in
galleryView.isInfinite: Bool // endless scrolling
galleryView.rightButton: UIButton // right navigation button
galleryView.leftButton: UIButton // left navigation button
galleryView.areButtonsHidden: Bool // turn navigation buttons on or off

Delegate protocol:

@objc public protocol LXGalleryViewDelegate {
optional func galleryViewDidPaged(_ galleryView: LXGalleryView, toPage: Int)
optional func galleryViewDidScroll(_ galleryView: LXGalleryView)
}

Donation

If you like my open source libraries, you can sponsor it! ☺️

paypal

Author

Leon Hoppe, [email protected]

License

Distributed under the MIT license. See LICENSE for more information.

lxgalleryview's People

Contributors

leonx98 avatar

Watchers

Carabineiro avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.