All Projects → nunogoncalves → Ios Multiselectiontable

nunogoncalves / Ios Multiselectiontable

Licence: other
Beautiful way of having a multi-selection table on iOS written in Swift

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Ios Multiselectiontable

Mycoretextlabel
图文混排 , 实现图片文字混排 , 可显示常规链接比如网址,@,#话题#,手机号 , 邮箱号等 , 可以自定义链接字,设置关键字高亮等功能 . 适用于微博,微信,IM聊天对话等场景 . 实现这些功能仅用了几百行代码,耦合性也较低
Stars: ✭ 192 (+23.08%)
Mutual labels:  ios-demo, ios-lib
Cocoaasyncsocket demo
基于AsyncSocket搭建即时通讯体系 . 包含TCP连接 , 消息发送 , 消息接收 , 心跳处理 ,断网重连 , 消息超时 , 消息分发 , 数据库结构设计 , 消息丢失等 . 以及UI设计, 文本表情消息/语音消息/图片消息/视频消息/文件消息/撤回消息/提示语消息的实现思路讲解
Stars: ✭ 981 (+528.85%)
Mutual labels:  ios-demo, ios-lib
Iosproject
IOS综合项目,完善的框架,路由模块化设计,集成科大讯飞SDK方便iOS基本输入控件实现语音辅助输入,UI效果参照京东APP,JS与OC交互,ionic跨平台开发,MQTT 协议,即时通讯协议,视屏播放,跑马灯效果 仿美团地图定位,城市收索, 友盟分享,基础动画 增加FCUIID帮助类,引导页功能模块,照片上传 ,UIView自定义导航栏,文件下载,Masonry 案例,fmdb,数据库,sqlite,百度地图,二维码,照片上传,照片上传有进度,列表倒计时,H5和原生交互,自定义各种弹框,常见表单类型,人脸识别,列表加载图片,列表拖拽,日历操作,导航条渐变,核心动画,动画特效等等
Stars: ✭ 291 (+86.54%)
Mutual labels:  ios-demo, ios-lib
Ios Arkit
iOS Location based Augmented Reality engine
Stars: ✭ 88 (-43.59%)
Mutual labels:  ios-demo, ios-lib
Avsqldebugger
A Simple Core Data Debugger that will look inside your apps DB
Stars: ✭ 30 (-80.77%)
Mutual labels:  ios-demo, ios-lib
Swiftcocoadsl
An easy way to write iOS UI
Stars: ✭ 103 (-33.97%)
Mutual labels:  ios-demo, ios-lib
Anwexpandscrollview
Expand - Collapse Scroll View - Animate With Pinch Gesture
Stars: ✭ 125 (-19.87%)
Mutual labels:  tableview
Arsegmentpager
segment tab controller with parallax Header
Stars: ✭ 1,691 (+983.97%)
Mutual labels:  tableview
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:  tableview
React Multi Select
A Multi Select component built with and for React
Stars: ✭ 111 (-28.85%)
Mutual labels:  multiselect
Mdtable
A data-driven UITableView framework
Stars: ✭ 153 (-1.92%)
Mutual labels:  tableview
Bookstore Ios
 Sample iOS App - A collection of examples and patterns for Unit Testing, UI Testing, handling Result/Optionals, writing documentation, and more. Details in README.
Stars: ✭ 147 (-5.77%)
Mutual labels:  ios-demo
Xlslideswitch
iOS 仿照今日头条滚动列表
Stars: ✭ 136 (-12.82%)
Mutual labels:  tableview
Geektime Ios Course
极客时间 —《从0开发一款iOS应用》讲义及示例工程
Stars: ✭ 126 (-19.23%)
Mutual labels:  ios-demo
Mfextractcolor
🐨从图片中自动提取特征颜色
Stars: ✭ 144 (-7.69%)
Mutual labels:  dribbble
Luexpandabletableview
A subclass of UITableView with expandable and collapsible sections
Stars: ✭ 125 (-19.87%)
Mutual labels:  tableview
Metalnanovg
The Metal port of NanoVG.
Stars: ✭ 151 (-3.21%)
Mutual labels:  ios-lib
Rxasdatasources
RxDataSource for AsyncDisplayKit/Texture
Stars: ✭ 114 (-26.92%)
Mutual labels:  tableview
Tableview
A RecyclerView that looks like a TableView, can scroll horizontally and vertically with a fixed header at the same time.
Stars: ✭ 135 (-13.46%)
Mutual labels:  tableview
Swiftui Tutorials
A code example and translation project of SwiftUI. / 一个 SwiftUI 的示例、翻译的教程项目。
Stars: ✭ 1,992 (+1176.92%)
Mutual labels:  ios-demo

iOS-MultiSelectionTable

Beautifull way of having a multi-selection table on iOS

Swift 5.1 Xcode 11.2.1+ Platforms iOS Licence MIT

Based on this dribbble by Vitaly Rubtsov

How it works:

MultiSelectionTable underneath is composed of a view and a data source, much like the UITableView's UITableViewDataSource/Delegate. They both know each other and communicate between themselves. The view is is composed by two configurable UITableView and a line seperating them. The DataSource keeps the data the UITableViews display.

Considerations:

(before Usage, pay attention to the following considerations)

  • In order to achieve a nice effect when transitioning, cells on the right (selected cells) must be equal to the cells on the left (all items cells).
  • The item object you are displaying, must conform with the Equatable protocol so the control can know where to move the items when unselecting items. -You can also paginate and use search on your items list. The table keeps a reference to the selected items.
  • The Marvel developers API has a 3000 requests limit per day. If this is reached and you can't try the Marvel example, you need to create a developers account to get credentials. Then replace them in Heroes.Fetcher.swift file

Usage:

Most basic usage:

Considering you are using MultiSelectionTableView in ViewController:

var multiSelectionDataSource: MultiSelectionDataSource<MyItem>! //MyItems must be Equatable
var multiSelectionTableView: MultiSelectionTableView!

var allItems: [MyItem] = [] //MyItem must be Equatable

override func viewDidLoad() {
     super.viewDidLoad()

     multiSelectionTableView = MultiSelectionTableView()
     view.addSubview(multiSelectionTableView)

     multiSelectionDataSource = MultiSelectionDataSource(multiSelectionTableView: multiSelectionTableView)
     multiSelectionDataSource.delegate = self
     let cellReuseIdentifier = "MyCell"
     multiSelectionDataSource.register(nib: UINib(nibName: "MyCustomCellNibName", bundle: nil), for: cellReuseIdentifier)

     multiSelectionDataSource.allItems = allItems

     multiSelectionTableView.dataSource = multiSelectionDataSource
 }

extension ViewController : MultiSelectionTableDelegate {

    func paint(_ cell: UITableViewCell, for indexPath: IndexPath, with item: Any) {
        if let cell = cell as? MyCustomCell,
            let myItem = item as? MyItem {
            //configureCellWithMyItem
        }
    }

}

Costumization

Colors style

multiSelectionTableView.controlBackgroundColor = .black
multiSelectionTableView.allItemsTableBackgroundColor = .black
multiSelectionTableView.selectedItemsTableBackgroundColor = .black

Horizontal movement width:

Depending on your cell, you might want to set the horizontal width the line moves. This value is based on the center X anchor.

multiSelectionTableView.seperatorWidthOffset = 100 //will move 100 point on both directions from the center

Animations

There are two animation types. The selection and the transition. You can customize your animations for both types. The default selection animation is a pulse starting on the tap point on the cell. The default transition animation moves a snapshot view of the selected cell to the corresponding side (depending on selection or unselection events)

multiSelectionTableView.cellAnimator = CellSelectionPulseAnimator(pulseColor: .black) // Must conform to CellSelectionAnimator
multiSelectionTableView.cellTransitioner = CellFlyerAnimator() // Must conform to CellTransitionAnimator

You can check out the animator examples.

Pagination

If you want MultiSelectionTableView to handle pagination you need to set:

multiSelectionTableView.supportsPagination = true

and you can add a target action to the control.

multiSelectionTableView.addTarget(self, action: #selector(loadMoreData(sender:)), for: .scrollReachingEnd)

Aditionally, you can have some control of when to get more data setting

multiSelectionTableView.paginationNotificationRowIndex = 5

this will call .scrollReachingEnd action 5 rows before reaching the end of the table, so you can pre fetch next page data.

Empty State View

It's common for results to come from the web, take some time loading, and/or be empty, and/or display an error. MultiSelectionTable has got you covered. If you want to display a custom empty view, just set the stateView with your view. For example a loading indicator:

let loadingView = UIActivityIndicatorView(
loadingView.transform = CGAffineTransform.init(scaleX: 2, y: 2)
loadingView.startAnimating()
multiSelectionTableView.stateView = loadingView

Target Actions

swift ... multiSelectionTableView.addTarget(self, action: #selector(selectedItem(sender:)), for: .itemSelected) multiSelectionTableView.addTarget(self, action: #selector(unselectedItem(sender:)), for: .itemUnselected)

//only called if supportsPagination is set to true multiSelectionTableView.addTarget(self, action: #selector(loadMoreData(sender:)), for: .scrollReachingEnd) ...

@objc private func selectedItem(sender: MultiSelectionTableView) { print("selected item") }

@objc private func unselectedItem(sender: MultiSelectionTableView) { print("unselected item") } ...

## Requirements

- iOS 9.0+
- Xcode 8.0+

## Installation

<details>
<summary>Cocoapods</summary>

MultiSelectionTable is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
platform :ios, '9.0'
use_frameworks!

pod 'MultiSelectionTable', git: 'https://github.com/nunogoncalves/iOS-MultiSelectionTable'

(Currently MultiSelectionTable is still not yet published to Cocoapods, so for now you need to add swift git: 'https://github.com/nunogoncalves/iOS-MultiSelectionTable'.

Manually Copy the contents of [Source](https://github.com/nunogoncalves/iOS-MultiSelectionTable/tree/master/Source) folder into your project and you're ready to go.

TODOs

Missing features and/or bugs can be found in the Issues section.

Author

Nuno Gonçalves

nunogoncalves @goncalvescmnuno

Contribute

Feel free to contribute to MultiSelectionTable. Check Issues before asking something or adding some contribuition that's already being done.

Licence

iOS-MultiSelectionTable is available under the MIT license. See the LICENSE file for more info.

Final note

If you use MultiSelectionTable in a production app, let me know. I'll be very flattered and pleased and sure want to be aware of it. :)

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