• Stars
    star
    454
  • Rank 92,622 (Top 2 %)
  • Language
    Swift
  • License
    MIT License
  • Created about 7 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

✨ Awesome expandable, collapsible tableview cell for iOS written in Swift 4

USE ExpandableCell. New version of this library.

YNExpandableCell

Awesome Version Carthage Compatible CocoaPods License: MIT Build Status Platform Swift 4.2

Updates

See CHANGELOG for details

Intoduction

Easiest usage of expandable & collapsible cell for iOS, written in Swift 4.2 You can customize expandable UITableViewCell whatever you like. YNExpandableCell is made because insertRows and deleteRows is hard to use. You can just inheirt YNTableViewDelegate and add one more method func tableView(_ tableView: YNTableView, expandCellAt indexPath) -> UITableViewCell?

demo

Requirements

YNExpandableCell written in Swift 3. Compatible with iOS 8.0+

Installation

Cocoapods

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

pod 'YNExpandableCell'

Carthage

github "younatics/YNExpandableCell"

Usage

import YNExpandableCell

Make YNTableView in Storyboard or in code

@IBOutlet var ynTableView: YNTableView!

Inherit YNTableViewDelegate

class ViewController: UIViewController, YNTableViewDelegate 

Set delegate and register cells

self.ynTableView.ynDelegate = self

let cells = ["YNExpandableCellEx","YNSliderCell","YNSegmentCell"]
self.ynTableView.registerCellsWith(nibNames: cells, and: cells)
self.ynTableView.registerCellsWith(cells: [UITableViewCell.self as AnyClass], and: ["YNNonExpandableCell"])

Use one of required method

Set expandable cell in YNTableViewDelegate method (Required)

func tableView(_ tableView: YNTableView, expandCellAt indexPath: IndexPath) -> UITableViewCell? {
    let ynSliderCell = tableView.dequeueReusableCell(withIdentifier: YNSliderCell.ID) as! YNSliderCell
    if indexPath.section == 0 && indexPath.row == 1 {
        return ynSliderCell
     }
     return nil
}

Set expandable cell with height in YNTableViewDelegate method using YNTableViewCell object (Required)

func tableView(_ tableView: YNTableView, expandCellWithHeightAt indexPath: IndexPath) -> YNTableViewCell? {
    let ynSliderCell = YNTableViewCell()
    ynSliderCell.cell = tableView.dequeueReusableCell(withIdentifier: YNSliderCell.ID) as! YNSliderCell
    ynSliderCell.height = 142

    if indexPath.section == 0 && indexPath.row == 1 {
        return ynSliderCell
    }
        return nil
}

Get didSelectRowAt in YNTableViewDelegate method (Optional)

func tableView(_ tableView: YNTableView, didSelectRowAt indexPath: IndexPath, isExpandableCell: Bool, isExpandedCell: Bool) {
    print("Selected Section: \(indexPath.section) Row: \(indexPath.row) isExpandableCell: \(isExpandableCell) isExpandedCell: \(isExpandedCell)")
}

Get didDeselectRowAt in YNTableViewDelegate method (Optional)

func tableView(_ tableView: YNTableView, didDeselectRowAt indexPath: IndexPath, isExpandableCell: Bool, isExpandedCell: Bool) {
    print("Deselected Section: \(indexPath.section) Row: \(indexPath.row) isExpandableCell: \(isExpandableCell) isExpandedCell: \(isExpandedCell)")
}

Set basic UITableViewDataSource, UITableViewDelegate and Done!

Customize

Expand & Collapse All if you want

self.ynTableView.expandAll()
self.ynTableView.collapseAll()

Inherit YNExpandableCell if you want awesome '+' '-' custom accessory type

class YNExpandableCellEx: YNExpandableCell

// Change normalCustomAccessoryType, selectedCustomAccessoryType Images

Cutomize UITableViewRowAnimation

self.ynTableView.ynTableViewRowAnimation = UITableViewRowAnimation.top

Make Extensions for more UITableViewDelegate if you need or make pull request for me :)

References

Please tell me or make pull request if you use this library in your application :)

Author

younatics Twitter

License

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

More Repositories

1

MotionBook

📖 Awesome iOS UI/UX Application (Open Source)
Swift
1,474
star
2

YNDropDownMenu

✨ Awesome Dropdown menu for iOS with Swift 5.0
Swift
1,335
star
3

YNSearch

🔍 Awesome fully customize search view like Pinterest written in Swift 5.0 + Realm support!
Swift
1,190
star
4

Highlighter

🖍 Highlight whatever you want!
Swift
930
star
5

ExpandableCell

✨ Awesome expandable, collapsible tableview cell for iOS written in Swift 5
Swift
761
star
6

MediaBrowser

🏞 A simple iOS photo and video browser with optional grid view, captions and selections written in Swift5.0
Swift
648
star
7

Dismissable

⚡️Dismissable is super convenient to dismiss with gesture!
Swift
306
star
8

Triangulation

Triangulation effect in iOS
Swift
172
star
9

PowerMode

🎶 PowerMode in iOS!
Swift
169
star
10

MotionBook-Source

Official MotionBook Source Code
Swift
151
star
11

Toggler

💡 Don't further use 'isSelected' to every button. use 'Toggler' to simply control your buttons
Swift
105
star
12

React-Native-Integration-with-existing-app

React Native Integration with existing app
53
star
13

PickColor

📌 Pick color in image, make placeholder color like Pinterest!
Swift
53
star
14

DeepLearningToMobile

Curated way to convert deep learning model to mobile⚡️
Jupyter Notebook
49
star
15

AppUpdater

❗️Check your update and show alert with one line of code
Swift
49
star
16

Collection-Data-Structures-Swift-KR

Swift Data Structure를 소개합니다.
Swift
45
star
17

fastlane-ios-example

Fastlane iOS Example for Beta, Release
Ruby
37
star
18

Stringfication

🔨 Make all objects to String!
Swift
33
star
19

Objectification

🔍 Return objects where string is contained in object! (useful with Search)
Swift
21
star
20

Shader

🌃 Make simple shade view with Shader!
Swift
16
star
21

GirlFriend

Prevent 404
12
star
22

NumiOS

⚡️Numpy in iOS
Swift
9
star
23

AI-in-iOS

AI in iOS
6
star
24

younatics.github.io

younatics.github.io
HTML
5
star
25

avplayer-sample

Swift
4
star
26

GWExtensions

Extensions of iOS Develop
Shell
3
star
27

opensource-test

Test for opensource
Swift
2
star
28

algorithm

Swift
2
star
29

Apple_Korean_keyboard_bug_report

Objective-C
2
star
30

Using-Realm-in-MotionBook

Using Realm in MotionBook
1
star
31

React-Native-Review-KR

리액트 네이티브를 사용한 후기를 공유합니다.
1
star
32

FilterChart

Filter Chart for iOS
Swift
1
star