Latest 1.0.0
Homepage https://github.com/leonx98/LXGalleryView
License MIT
Platforms ios 9.0
Authors

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

LXGalleryView is a customizable slideshow for custom cells.

LXGalleryView

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.

Latest podspec

{
    "name": "LXGalleryView",
    "version": "1.0.0",
    "summary": "A GalleryView for custom Cells",
    "homepage": "https://github.com/leonx98/LXGalleryView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Leon Hoppe": "[email protected]"
    },
    "source": {
        "git": "https://github.com/leonx98/LXGalleryView.git",
        "tag": "1.0.0"
    },
    "swift_version": "4.0",
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "LXGalleryView/Classes/**/*",
    "resource_bundles": {
        "LXGalleryView": [
            "LXGalleryView/Assets/*.xcassets"
        ]
    }
}

Pin It on Pinterest

Share This