Skip to content

AdieOlami/Lope

Repository files navigation

Lope

Coverage [Documentation

Awesome

Version

Language

Git Twitter LinkedIn eMail

This is an easy and Elegant SliderView which you can easily implemet in your application.

[Build Status][travis-url]

Lope gives you a smooth and easy experience when implemeting in your app. It is easy to customize and modify.

Installation

Cocoapods:

pod install 'Lope'

Cartage:

Coming Soon

Usage example

Development setup

Initiate Lope in your UIViewController like this

import Lope

var lope: Lope!

call the lope in your viewDidLoad and access other properties

override func viewDidLoad() {
    super.viewDidLoad()

    view.backgroundColor = .white
    lope = Lope(frame: CGRect.zero)
    lope.delegate = self
    lope.translatesAutoresizingMaskIntoConstraints = false
    self.view.addSubview(lope)
    setup()

}

Programmatically: create your function give it any name

func setup() {

    NSLayoutConstraint.activate([
    //            lope.centerXAnchor.constraint(equalTo: view.centerXAnchor, constant: 0),
    //            lope.centerYAnchor.constraint(equalTo: view.centerYAnchor, constant: 0),

    lope.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 0),

    lope.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0),
    lope.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 0),
    lope.heightAnchor.constraint(equalToConstant: 64),
    ])
}

Delegate method on what to do on completion

extension ViewController: LopeDelegate {
    func startSlide(_ start: Bool) {
        print("startSlide Lope")
    }

    func endSlide(_ end: Bool) {
        print("endSlide Lope")
        if end {
            let alert = UIAlertController(title: "Lope", message: "Slide Done", preferredStyle: UIAlertController.Style.alert)
            alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil))
            self.present(alert, animated: true, completion: nil)
        }
    }

}

Other accessible variables

sliderBackgroundColor: UIColor? = .black
baseViewBackgroundColor: UIColor? = .gray
titleTextColor: UIColor? = .black

Release History

  • 0.1.1
  • CHANGE: Update docs (module code remains unchanged)

Meta

Adie Olalekan – @AdieOlamiugbeadie@gmail.com

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

https://github.com/AdieOlami/Lope

Contributing

  1. Fork it (https://github.com/AdieOlami/Lope/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request