SListView

0.0.1

SListView is a view group that displays a list of scrollable items.
shial4/SListView

What's New

Release 0.0.1

2018-03-08T01:29:43Z

Single cell list view

SListView

Language License CocoaPods Carthage

Swift list view collection.

🔧 Installation

CocoaPods:

Add the line pod "SLSListView" to your Podfile

Carthage:

Add the line github "shial4/SListView" to your Cartfile

Manual:

Clone the repo and drag the folder SListView into your Xcode project.

Swift Package Manager:

Add the line .package(url: "https://github.com/shial4/SListView.git", from: "0.0.1"), to your Package.swift

Swift Package Manager in your iOS Project: This project demonstrates a working method for using Swift Package Manager (SPM) to manage the dependencies of an iOS project.

Example of how to use SPM v4 to manage iOS dependencies

💊 Usage

import UIKit
import SListView

``

Inherit from the `ListViewController`

class CalendarViewController: ListViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        listView.registerClassForListViewCell(CustomListViewCell.self)
        listView.marginForItem = UIEdgeInsets(top: 8, left: 12, bottom: 8, right: 12)
        listView.scrollDirection = .vertical
        listView.reloadData()
    }
    
    override func listView(_ listView: ListView, didChangeDisplayItemAt index: Int, with offset: Int) {
        //Do your stuff here.
    }
    
    override func listView(_ listView: ListView, willDisplay cell: ListViewCell, at index: Int, with offset: Int) {
        guard let cell = cell as? CustomListViewCell else { return }
        //Do your stuff here.
    }
}

Or conform to ListView protocols

class CalendarViewController: UIViewController, ListViewDelegate, ListViewDatasource {
    @IBOutlet weak var listView: ListView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        listView.registerClassForListViewCell(CalendarMonthViewCell.self)
        listView.marginForItem = UIEdgeInsets(top: 8, left: 12, bottom: 8, right: 12)
        listView.scrollDirection = .vertical
        listView.reloadData()
    }
    
    func listView(_ listView: ListView, didChangeDisplayItemAt index: Int, with offset: Int) {
        //Do your stuff here.
    }
    
    func listView(_ listView: ListView, willDisplay cell: ListViewCell, at index: Int, with offset: Int) {
        guard let cell = cell as? CalendarMonthViewCell else { return }
        //Do your stuff here.
    }
}

Contributing

Be welcome to contribute to this project! :)

Questions

Just create an issue on GitHub.

📝 License

This project was released under the MIT license.

Description

  • Swift Tools 4.0.0
View More Packages from this Author

Dependencies

  • None
Last updated: Wed Nov 09 2022 23:01:03 GMT-0500 (GMT-05:00)