Latest 1.2.6
Homepage https://github.com/Vkt0r/AccordionMenuSwift
License MIT
Platforms ios 8.0
Authors

Accordion Custom Image


Build Status


Pods Version


Swift Version


License Type


An accordion/dropdown menu to integrate in your projects.

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

Requirements 💥

  • iOS 8.0+
  • Xcode 8.0+

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 Alamofire 4.0.0+.

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

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

target '<Your Target Name>' do
    pod 'AccordionMenuSwift', '~> 1.2.6'
end

Then, run the following command:

$ pod install

Usage ✨

After import the framework it’s neccessary to inherit from the class AccordionTableViewController and set it’s data source the total of items from the data source and if you like if several cells is expanded or only one like in the following example:

import UIKit
import AccordionMenuSwift

class AccordionViewController: AccordionTableViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        let item1 = Parent(state: .collapsed, childs: ["SubItem 1", "SubItem 2", "SubItem 3"], title: "Item 1")
        let item2 = Parent(state: .collapsed, childs: ["SubItem 1", "SubItem 2"], title: "Item 2")
        let item3 = Parent(state: .collapsed, childs: ["SubItem 1", "SubItem 2", "SubItem 3"], title: "Item 3")
        let item4 = Parent(state: .collapsed, childs: ["SubItem 1", "SubItem 2"], title: "Item 4")
        let item5 = Parent(state: .collapsed, childs: [], title: "Item 5") // No childs for this cell

        dataSource = [item1, item2, item3, item4, item5]
        numberOfCellsExpanded = .several
        total = dataSource.count
    }
}

In the above example the AccordionViewController in Interface Builder it’s an UITableViewController.

Afterwards it’s necessary to define two cells in the UITableView with the identifiers "ParentCell" and "ChildCell".

You can see the Example project for more information in how to integrate it.

ToDo

  • [ ] Add Carthage support.
  • [ ] Add suport to be notified when cell is tapped using closures.
  • [ ] Add support for multiple levels
  • [ ] Improve the integration with functional programming
  • [ ] Add unit tests for the library

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 infomation.

Latest podspec

{
    "name": "AccordionMenuSwift",
    "version": "1.2.6",
    "summary": "An Accordion Menu using an UITableView in Swift.",
    "description": "The best way of implement an accordion menu using an UITableView in Swift",
    "homepage": "https://github.com/Vkt0r/AccordionMenuSwift",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Victor Sigler": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Vkt0r/AccordionMenuSwift.git",
        "tag": "v1.2.6"
    },
    "social_media_url": "https://twitter.com/Vkt0r",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "AccordionMenuSwift/Source/**/*",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This