All Projects → alicanbatur → Abexpandableview

alicanbatur / Abexpandableview

Licence: mit
Expandable, collapsible, filterable and single/multi selectable table view.

Programming Languages

swift
15916 projects
swift4
162 projects

Projects that are alternatives of or similar to Abexpandableview

Luexpandabletableview
A subclass of UITableView with expandable and collapsible sections
Stars: ✭ 125 (-9.42%)
Mutual labels:  cocoapods, pod, tableview, expandable, collapsible
Rsformview
A Cocoapods library designed to easily create forms with multiple data entry fields
Stars: ✭ 84 (-39.13%)
Mutual labels:  cocoapods, pod, cocoapod, ui-components
Campcotcollectionview
Collapse and expand UICollectionView sections with one method call.
Stars: ✭ 161 (+16.67%)
Mutual labels:  cocoapods, expandable, collapsible
Bekcurvetabbar
Full Customizable Tabbar with IBInspectables
Stars: ✭ 144 (+4.35%)
Mutual labels:  cocoapods, pod, ui-components
Containercontroller
UI Component. This is a copy swipe-panel from app: Apple Maps, Stocks. Swift version
Stars: ✭ 273 (+97.83%)
Mutual labels:  cocoapods, ui-components, tableview
Ynexpandablecell
✨ Awesome expandable, collapsible tableview cell for iOS written in Swift 4
Stars: ✭ 445 (+222.46%)
Mutual labels:  tableview, expandable, collapsible
Nim ios uikit
网易云信 iOS UI 组件,提供聊天界面,文本消息,图片消息,语音消息,视频消息,地理位置消息,自定义消息(阅后即焚)等消息示例。#推荐客户得比特币,首次推荐得0.02BTC,连续推荐得0.03BTC/单,上不封顶。点击参与https://yunxin.163.com/promotion/recommend
Stars: ✭ 1,326 (+860.87%)
Mutual labels:  cocoapods, pod, ui-components
Scenekit Bezier Animations
Create animations over Bezier curves of any number of points
Stars: ✭ 35 (-74.64%)
Mutual labels:  cocoapods, cocoapod
Wstagsfield
An iOS text field that represents tags, hashtags, tokens in general.
Stars: ✭ 1,013 (+634.06%)
Mutual labels:  cocoapods, ui-components
Swifttwitch
👾 The New Twitch API for iOS; wrapped in Swift goodness 👾
Stars: ✭ 72 (-47.83%)
Mutual labels:  pod, cocoapod
Stickytabbarviewcontroller
Sticky and Collapsible View on top of tab bar
Stars: ✭ 82 (-40.58%)
Mutual labels:  ui-components, collapsible
Android Expandicon
Nice and simple customizable implementation of Google style up/down expand arrow.
Stars: ✭ 871 (+531.16%)
Mutual labels:  ui-components, expandable
Modelassistant
Elegant library to manage the interactions between view and model in Swift
Stars: ✭ 26 (-81.16%)
Mutual labels:  mvvm, tableview
Pulltorefresh
This component implements pure pull-to-refresh logic and you can use it for developing your own pull-to-refresh animations
Stars: ✭ 1,150 (+733.33%)
Mutual labels:  cocoapods, tableview
Numericaltextentry
An iOS library for beautiful number entry fields. iPad friendly. Written in Swift.
Stars: ✭ 16 (-88.41%)
Mutual labels:  pod, cocoapod
Parallaxheader
Simple way to add parallax header to UIScrollView/UITableView written in Swift.
Stars: ✭ 808 (+485.51%)
Mutual labels:  cocoapods, tableview
Hover
🎈 The smartest floating button
Stars: ✭ 81 (-41.3%)
Mutual labels:  cocoapods, ui-components
Slidingtabbar
A custom TabBar view with sliding animation written in Swift.
Stars: ✭ 84 (-39.13%)
Mutual labels:  cocoapods, ui-components
Datepicker
A Date Picker with Calendar for iPhone and iPad Apps.
Stars: ✭ 103 (-25.36%)
Mutual labels:  cocoapods, cocoapod
Cuckoo
Boilerplate-free mocking framework for Swift!
Stars: ✭ 1,344 (+873.91%)
Mutual labels:  protocol, cocoapods

ABExpandableView

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first. Then run ABExpandableView.xcworkspace which is under /Example folder.

Requirements

  • Swift 4
  • Xcode 9

Installation

ABExpandableView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'ABExpandableView'

Usage

First, import ABExpandableView to your project.

You should have 2 kinds of model objects to use this view that one of them should be section and the other one should be row.

Consider, Section and Row classes are your objects.

class Section: SectionItem {
    var identifier: String!
    var name: String!
    
    var expanded: Bool = true
    
    var rows: [RowItem] = [RowItem]()
    var rawRows: [RowItem] = [RowItem]() {
        didSet {
            rows = rawRows
        }
    }
    var selectedRows: [RowItem] = [RowItem]()
}

class Row: RowItem {
    var identifier: String!
    var name: String!
}

class MockDataProvider {
    
    class func createMockData() -> [SectionItem] {
        var array = [SectionItem]()
        
        let izmir = City()
        izmir.identifier = "35"
        izmir.name = "İzmir"
        let bornova = Town(identifier: "1", name: "Bornova")
        let urla = Town(identifier: "2", name: "Urla")
        let konak = Town(identifier: "3", name: "Konak")
        let izmirRawRows = [bornova, urla, konak]
        izmir.rawRows = izmirRawRows
        array.append(izmir)
        
        let istanbul = City()
        istanbul.identifier = "34"
        istanbul.name = "İstanbul"
        let kadikoy = Town(identifier: "4", name: "Kadıköy")
        let maltepe = Town(identifier: "5", name: "Maltepe")
        let beykoz = Town(identifier: "6", name: "Beykoz")
        let istanbulRawRows = [kadikoy, maltepe, beykoz]
        istanbul.rawRows = istanbulRawRows
        array.append(istanbul)
        
        return array
    }
    
}

After you create your models, you should open ABExpandableView with injecting those model array.

@IBAction func buttonTapped(_ sender: Any) {
        let cities = MockDataProvider.createMockData()
        let expandableSectionsViewModel = ExpandableSectionsViewModel(cities)
        let expandableSectionViewController = ExpandableSectionsViewController.newInstance(expandableSectionsViewModel)
        expandableSectionViewController.title = "Choose Town(s)"
        expandableSectionViewController.delegate = self
        self.navigationController?.pushViewController(expandableSectionViewController, animated: true)
    }

Here, let ABExpandableView handle the rest.

One last thing; You can get selected items using the delegation;

    func didSelectItems(_ items: [RowItem]) {
        let names = items.flatMap { $0.name }.joined(separator: ", ")
        // "Bornova, Kadıköy"
    }

Author

alicanbatur, [email protected]

License

ABExpandableView is available under the MIT license. See the LICENSE file for more info.

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