All Projects → Vkt0r → Accordionswift

Vkt0r / Accordionswift

Licence: mit
The best way of implement an accordion menu using an UITableView in Swift

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Accordionswift

Luexpandabletableview
A subclass of UITableView with expandable and collapsible sections
Stars: ✭ 125 (-19.87%)
Mutual labels:  xcode, cocoapods, tableview
Parallaxheader
Simple way to add parallax header to UIScrollView/UITableView written in Swift.
Stars: ✭ 808 (+417.95%)
Mutual labels:  xcode, cocoapods, tableview
Containercontroller
UI Component. This is a copy swipe-panel from app: Apple Maps, Stocks. Swift version
Stars: ✭ 273 (+75%)
Mutual labels:  xcode, cocoapods, tableview
Microfeatures Example
📦📱 Example of iOS app built using the uFeatures architecture
Stars: ✭ 112 (-28.21%)
Mutual labels:  xcode, cocoapods
Materialactivityindicator
Material Activity Indicator
Stars: ✭ 109 (-30.13%)
Mutual labels:  xcode, cocoapods
Device
Light weight tool for detecting the current device and screen size written in swift.
Stars: ✭ 1,503 (+863.46%)
Mutual labels:  xcode, cocoapods
Emptykit
A lightweight, swift library for displaying emptyView whenever the view(tableView/collectionView) has no content to display, just like DZNEmptyDataSet
Stars: ✭ 117 (-25%)
Mutual labels:  xcode, tableview
Sqift
Powerful Swift wrapper for SQLite
Stars: ✭ 119 (-23.72%)
Mutual labels:  xcode, cocoapods
Croc
Swift emoji string parsing library
Stars: ✭ 124 (-20.51%)
Mutual labels:  xcode, cocoapods
Natrium
A pre-build (Swift) script to alter your Xcode project at pre-build-time per environment, build configuration and target.
Stars: ✭ 131 (-16.03%)
Mutual labels:  xcode, cocoapods
Testdrive
Quickly try out any Swift pod or framework in a playground
Stars: ✭ 1,612 (+933.33%)
Mutual labels:  xcode, cocoapods
Abexpandableview
Expandable, collapsible, filterable and single/multi selectable table view.
Stars: ✭ 138 (-11.54%)
Mutual labels:  cocoapods, tableview
Alamofire
Elegant HTTP Networking in Swift
Stars: ✭ 36,896 (+23551.28%)
Mutual labels:  xcode, cocoapods
Swifterswift
A handy collection of more than 500 native Swift extensions to boost your productivity.
Stars: ✭ 10,706 (+6762.82%)
Mutual labels:  xcode, cocoapods
Shari
Shari is the alternative to the library of UIPickerView(drum roll) in Swift. You can select a item using UITableView.
Stars: ✭ 111 (-28.85%)
Mutual labels:  xcode, cocoapods
Nextgrowingtextview
📝 The next in the generations of 'growing textviews' optimized for iOS 8 and above.
Stars: ✭ 1,540 (+887.18%)
Mutual labels:  xcode, cocoapods
Everlayout
Reusable, downloadable, up-datable iOS layouts
Stars: ✭ 103 (-33.97%)
Mutual labels:  xcode, cocoapods
Swiftcolorgen
A tool that generate code for Swift projects, designed to improve the maintainability of UIColors
Stars: ✭ 152 (-2.56%)
Mutual labels:  xcode, cocoapods
Mscircularslider
A fully-featured, powerful circular slider for iOS applications
Stars: ✭ 94 (-39.74%)
Mutual labels:  xcode, cocoapods
Pluggableappdelegate
!! No longer supported !! A lightweight service-oriented AppDelegate for iOS, made in Swift.
Stars: ✭ 96 (-38.46%)
Mutual labels:  xcode, cocoapods

Accordion Custom Image

Pods Version Swift Version License Type


An accordion/dropdown menu to integrate in your projects. This library is protocol oriented, type safe and the new version is inspired in JSQDataSourcesKit by Jesse Squires.

Main Features
📱 Compatible with iPhone / iPad
🔨 Fully customizable cells
🚒 Supports device rotation
🔥 Written completely in Swift

Requirements 💥

  • iOS 10.0+
  • Xcode 10.2+

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 1.1.0+ is required to build AccordionSwift 2.0.0+.

To integrate AccordionSwift into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'AccordionSwift', '~> 2.0.0'
end

Then, run the following command:

$ pod install

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate AccordionSwift into your Xcode project using Carthage, specify it in your Cartfile:

github "Vkt0r/AccordionSwift" ~> 2.0.0

Usage ✨

After importing the framework, the library can be used in a UITableViewController or a UIViewController and offers full customization of the cells and data source:

import UIKit
import AccordionSwift

class AccordionViewController: UIViewController {
    
    // MARK: - IBOutlets
    
    @IBOutlet weak var tableView: UITableView!
    
    // MARK: - Typealias
    
    typealias ParentCellModel = Parent<GroupCellModel, CountryCellModel>
    typealias ParentCellConfig = CellViewConfig<ParentCellModel, UITableViewCell>
    typealias ChildCellConfig = CellViewConfig<CountryCellModel, CountryTableViewCell>
    
    // MARK: - Properties
    
    /// The Data Source Provider with the type of DataSource and the different models for the Parent and Chidl cell.
    var dataSourceProvider: DataSourceProvider<DataSource<ParentCellModel>, ParentCellConfig, ChildCellConfig>?
    
    // MARK: - UIViewController
    
    override func viewDidLoad() {
        super.viewDidLoad()
        configDataSource()
        
        navigationItem.title = "World Cup 2018"
    }
}

The above example shows how to define a CellViewConfig for the parent and child cells respectively and how to define the Parent model.

/// Defines a cell config type to handle a UITableViewCell
public protocol CellViewConfigType {
    
    // MARK: Associated types
    
    /// The type of elements backing the collection view or table view.
    associatedtype Item
    
    /// The type of views that the configuration produces.
    associatedtype Cell: UITableViewCell
    
    // MARK: Methods
    
    func reuseIdentiferFor(item: Item?, indexPath: IndexPath) -> String
    
    @discardableResult
    func configure(cell: Cell, item: Item?, tableView: UITableView, indexPath: IndexPath) -> Cell
}

Another step is to define the DataSourceProvider in charge of handling the data source and the CellViewConfig for each cell. The DataSourceProvider exposes the numberOfExpandedParentCells attribute which can be used to change the behavior of the accordion to only have a single item open at once or to have multiple items open at any given time. Take note that the default behavior is to have multiple items open.

For a more detailed guide please see the Example project.

Screenshots

screenshot

Example of multiple cells open at a time

screenshot

Example of single cells open at a time

screenshot

TODO

  • [ ] Add unit tests for the library.
  • [ ] Add CircleCI integration.

Feedback

I've found a bug, or have a feature request

Please raise a GitHub issue. 😱

Interested in contributing?

Great! Please launch a pull request. 👍


License:

The MIT License. See the LICENSE file for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].