shial4/slistview
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.
<a href="https://github.com/j-channings/swift-package-manager-ios">Example of how to use SPM v4 to manage iOS dependencies</a>
π 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.
Package Metadata
Repository: shial4/slistview
Default branch: master
README: README.md