CITreeView created to implement and maintain that wanted TreeView structures for IOS platforms easy way

Related tags

UI CITreeView
Overview

CITreeView

CITreeView created to implement and maintain that wanted TreeView structures for IOS platforms easy way. CITreeView provides endless treeview structure. You just add your data to CITreeview datasource.

Twitter: @cekjacks CocoaPods Platform

|

Installation

CocoaPods (Recommended)

  1. Add additional entry to your Podfile.
pod 'CITreeView', '~> 1.6.1'
  1. Pod Install
pod install

Manual

  1. Download .zip file
  2. Just drag and drop CITreeViewClasses folder to your project

Usage

Initialization

  1. Firstly, import CITreeView
import CITreeView
  1. Add CITreeViewDelegate and CITreeViewDataSource to your view controller
class ViewController:UIViewController,CITreeViewDelegate,CITreeViewDataSource
  1. Initialize and configure CITreeView
let ciTreeView = CITreeView.init(frame: self.view.bounds, style: UITableViewStyle.plain)
ciTreeView.treeViewDelegate = self
ciTreeView.treeViewDataSource = self
self.view.addSubview(ciTreeView)
  1. Implement required methods of the CITreeView's delegates
func treeView(_ treeView: CITreeView, atIndexPath indexPath: IndexPath, withTreeViewNode treeViewNode: CITreeViewNode) -> UITableViewCell {

return cell;
}
func treeViewSelectedNodeChildren(for treeViewNodeItem: AnyObject) -> [AnyObject] {
        if let dataObj = treeViewNodeItem as? CITreeViewData {
            return dataObj.children
        }
        return []
    }
func treeViewDataArray() -> [AnyObject] {
return yourDataArray
}
func treeView(_ tableView: CITreeView, heightForRowAt indexPath: IndexPath, withTreeViewNode treeViewNode:CITreeViewNode) -> CGFloat {
return UITableViewAutomaticDimension
}
func treeView(_ treeView: CITreeView, didSelectRowAt treeViewNode:CITreeViewNode) {}

func willExpandTreeViewNode(treeViewNode: CITreeViewNode, atIndexPath: IndexPath) {}

func didExpandTreeViewNode(treeViewNode: CITreeViewNode, atIndexPath: IndexPath) {}

func willCollapseTreeViewNode(treeViewNode: CITreeViewNode, atIndexPath: IndexPath) {}

func didCollapseTreeViewNode(treeViewNode: CITreeViewNode, atIndexPath: IndexPath) {}

Features

  1. You can only open one node at a time if you wish. If another parent node is selected while a node is opened, the open nodes will closed automatically.
ciTreeView.collapseNoneSelectedRows = true

Recently Added Features

1. connect CITreeView delegate and datasource with interface builder
2. expand all rows with expandAllRows()
3. collapse all rows with collapseAllRows()
4. get parent node of selected node as CITreeViewNode.parentNode
5. reload data without lose rows states that expanded or collapses with reloadDataWithoutChangingRowStates()

License

MIT licensed, Copyright (c) 2018 Cenk Işık, @cekjacks

Comments
  • How Can I view an array inside a subChild ?

    How Can I view an array inside a subChild ?

    Hi , Thank you for this framework , it's so helpful !

    I'm trying to show an array of values inside a subChild (one value in it's own cell) and i can't figure it out yet

    In a normal tableView it would be like : myLabel.text = myArray[indexPath.row]

    Is it possible to do that ? Check my demo project to see what i'm trying to explain and you can see my data from the api link: https://github.com/cs4alhaider/URL-analytics

    opened by cs4alhaider 4
  • Handling JSON response

    Handling JSON response

    This is the response I get in json

    https://justpaste.it/8d2va

    The backend wants me to create a child when there is . in path key. For example: INBOX.Aliqua.NewFolder

    Parent - Inbox Child - Aliqua Sub Child - NewFolder

    Now the problem is i get INBOX.Aliqua in previous index (and so for other folders). I have tried contacting them to send a better response but they claim it is working on their web. Any help would be appreciated.

    opened by harsh12312 0
  • Put in order class files and example

    Put in order class files and example

    Project had two copies of CITreeViewClasses in the root and inside example app, and they were different. SPM and Cocoapods used files from the root which were obsolete. So, I have replaced files at root with files from example and changed example to comply these files.

    opened by mrgerh 1
  • collapseAllRows() causes a crash when called in didSelectRowAt

    collapseAllRows() causes a crash when called in didSelectRowAt

    I'm about to implement that when there is a child that is not expandable, then return selected cell + collapse whole treeView. But when I call collapseAllRows() in didSelectRowAt, there goes a crash. You can replicate that in demo project by adding:

        func treeView(_ treeView: CITreeView, didSelectRowAt treeViewNode: CITreeViewNode, at indexPath: IndexPath) {
            guard let cellData = treeViewNode.item as? CITreeViewData else {fatalError()}
            if cellData.children.isEmpty {
                self.sampleTreeView.collapseAllRows()
            }
        }
    

    Pod version: 1.6.1 Then tap Sedan -> Alfa Romeo. After that there goes "Index out or range error" in setExpandTreeViewNode of CTTreeViewController.

    opened by swiatrzyk 0
  • How to load cell data from server when index tapped at level 1?

    How to load cell data from server when index tapped at level 1?

    Basically I have level 1 data at start and when user tap on any cell I am fetching data for that selected index. and I want to show that data once I got it from server and same goes on for next tap. how I can achieve that with this lib?

    opened by dharmeshkheniios 2
Releases(1.6.1)
Owner
Cenk Işık
Mobile Engineering Team Lead @trendyol
Cenk Işık
Windless makes it easy to implement invisible layout loading view.

Windless Windless makes it easy to implement invisible layout loading view. Contents Requirements Installation Usage Looks Credits Communication Licen

ArLupin 940 Dec 22, 2022
Non-intrusive iOS UI library to implement overlay based interfaces

OverlayContainer is a UI library written in Swift. It makes easier to develop overlay based interfaces, such as the one presented in the Apple Maps, S

Applidium 1k Jan 4, 2023
Blobmorphism is a brand new design language I've created to break free of the material overload in iOS, built in SwiftUI. Everything feels smooth and fluid.

Blobmorphism is a brand new design language I've created to break free of the material overload in iOS, built in SwiftUI. Everything feels smooth and fluid.

Ethan Lipnik 89 Nov 29, 2022
Twinkle is a Swift and easy way to make any UIView in your iOS or tvOS app twinkle.

Twinkle ✨ Twinkle is a Swift and easy way to make any UIView in your iOS or tvOS app twinkle. This library creates several CAEmitterLayers and animate

patrick piemonte 600 Nov 24, 2022
A number of preset loading indicators created with SwiftUI

ActivityIndicatorView A number of preset loading indicators created with SwiftUI We are a development agency building phenomenal apps. Usage Create an

Exyte 956 Dec 26, 2022
This is the replica of Foursquare application, created using storyboard.

FourSquare-Storyboard- This is the replica of Foursquare application, created using storyboard. API Usage from Foursuare Places Search Get Place Detai

Yasir Siddique 2 Oct 31, 2022
An easy way to add a shimmering effect to any view with just one line of code. It is useful as an unobtrusive loading indicator.

LoadingShimmer An easy way to add a shimmering effect to any view with just single line of code. It is useful as an unobtrusive loading indicator. Thi

Jogendra 1.4k Jan 4, 2023
Fashion is your helper to share and reuse UI styles in a Swifty way.

Fashion is your helper to share and reuse UI styles in a Swifty way. The main goal is not to style your native apps in CSS, but use a set

Vadym Markov 124 Nov 20, 2022
☠️ An elegant way to show users that something is happening and also prepare them to which contents they are awaiting

Features • Guides • Installation • Usage • Miscellaneous • Contributing ?? README is available in other languages: ???? . ???? . ???? . ???? . ???? To

Juanpe Catalán 11.7k Jan 6, 2023
Custom emojis are a fun way to bring more life and customizability to your apps.

Custom emojis are a fun way to bring more life and customizability to your apps. They're available in some of the most popular apps, such as Slack, Di

Stream 244 Dec 11, 2022
The Bloc Pattern is a way to separate UI and Logic in SwiftUI codes;

The Bloc Pattern is a way to separate UI and Logic in SwiftUI codes. The Bloc is like a state machine where it accepts an event and produce a state.

mehdi sohrabi 3 Apr 20, 2022
UIPheonix is a super easy, flexible, dynamic and highly scalable UI framework + concept for building reusable component/control-driven apps for macOS, iOS and tvOS

UIPheonix is a super easy, flexible, dynamic and highly scalable UI framework + concept for building reusable component/control-driven apps for macOS, iOS and tvOS

Mohsan Khan 29 Sep 9, 2022
A way to quickly add a notification badge icon to any view. Make any view of a full-fledged animated notification center.

BadgeHub A way to quickly add a notification badge icon to any view. Demo/Example For demo: $ pod try BadgeHub To run the example project, clone the r

Jogendra 772 Dec 28, 2022
A better way to present a SFSafariViewController or start a ASWebAuthenticationSession in SwiftUI.

BetterSafariView A better way to present a SFSafariViewController or start a ASWebAuthenticationSession in SwiftUI. Contents Motivation Requirements U

Dongkyu Kim 392 Dec 31, 2022
A simple way to hide the notch on the iPhone X

NotchKit NotchKit is a simple way to hide the notch on the iPhone X, and create a card-like interface for your apps. Inspired by this tweet from Sebas

Harshil Shah 1.8k Dec 5, 2022
DrawerKit lets an UIViewController modally present another UIViewController in a manner similar to the way Apple's Maps app works.

DrawerKit What is DrawerKit? DrawerKit is a custom view controller presentation mimicking the kind of behaviour in the Apple Maps app. It lets any vie

Babylon Health 773 Dec 27, 2022
ToastSwiftUI-master - A simple way to show a toast or a popup in SwiftUI

ToastSwiftUI-master - A simple way to show a toast or a popup in SwiftUI

Kushal Shingote 2 May 25, 2022
Powerful and easy-to-use vector graphics Swift library with SVG support

Macaw Powerful and easy-to-use vector graphics Swift library with SVG support We are a development agency building phenomenal apps. What is Macaw? Mac

Exyte 5.9k Jan 1, 2023
An easy to use FAQ view for iOS written in Swift

FAQView An easy to use FAQ view for iOS written in Swift. This view is a subclass of UIView. Setup with CocoaPods If you are using CocoaPods add this

Mukesh Thawani 467 Dec 5, 2022