All Projects → djs66256 → DDComponent

djs66256 / DDComponent

Licence: MIT license
Make a collection controller to several component, like IGList

Programming Languages

objective c
16641 projects - #2 most used programming language
Objective-C++
1391 projects
swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to DDComponent

SwiftWaterfallFlow
swift写的瀑布流布局
Stars: ✭ 37 (+2.78%)
Mutual labels:  collectionview
SNCollectionViewLayout
Collection View Layouts is a set of custom flow layouts for iOS which imitate general data grid approaches for mobile apps.
Stars: ✭ 100 (+177.78%)
Mutual labels:  collectionview
CollectionViewDiffableGameDB
Game DB iOS App using iOS 13 NSDiffableDataSourceSnapshot to filter, sort, and search with animations
Stars: ✭ 17 (-52.78%)
Mutual labels:  collectionview
Eblo
A Fancy Engineering Blogs Reader
Stars: ✭ 57 (+58.33%)
Mutual labels:  iglistkit
ShortcutsCollectionView
Create custom collectionView like Apple’s Shortcuts app in Code.
Stars: ✭ 24 (-33.33%)
Mutual labels:  collectionview
Pickme
iOS Picker for ninjas
Stars: ✭ 29 (-19.44%)
Mutual labels:  collectionview
MMAdvertScrollView
一个简单、轻量级的swift版公告轮播框架
Stars: ✭ 42 (+16.67%)
Mutual labels:  collectionview
ios-swift-uicollectionviewcell-from-xib
Create CollectionView Xib cell for UICollectionView using Swift 3
Stars: ✭ 12 (-66.67%)
Mutual labels:  collectionview
Multiple-collectionView-in-Multiple-tableView-cells
UICollectionView is embed in UITableViewCell. The collection views are horizontal scrollable. The UITableView can have a section title for each UICollectionView and the number of UICollectionView is equal to the number of sections.
Stars: ✭ 23 (-36.11%)
Mutual labels:  collectionview
THCalendar
Calendar like iOS
Stars: ✭ 21 (-41.67%)
Mutual labels:  collectionview
SectionReactor
A ReactorKit extension for managing table view and collection view sections with RxDataSources
Stars: ✭ 45 (+25%)
Mutual labels:  collectionview
SSCTaglistView
Customizable iOS tag list view, in Swift.
Stars: ✭ 54 (+50%)
Mutual labels:  collectionview
Pinterest-Application
Build an application like Pinterest in Swift 4
Stars: ✭ 31 (-13.89%)
Mutual labels:  collectionview
LQIMInputView
一个聊天输入框的工具栏,类似微信聊天工具栏,可自定义,集成方便
Stars: ✭ 28 (-22.22%)
Mutual labels:  collectionview
JHCollectionViewFlowLayout
CollectionView horizontal layout,横向排版
Stars: ✭ 30 (-16.67%)
Mutual labels:  collectionview
MGGridView
MGGridView is a grid view created by a combination of collection views.
Stars: ✭ 25 (-30.56%)
Mutual labels:  collectionview
KNURE-TimeTable
🎓 iOS приложение для просмотра расписания ХНУРЭ
Stars: ✭ 21 (-41.67%)
Mutual labels:  collectionview
FocusOnXamarin
NET Conf: Focus on Xamarin samples
Stars: ✭ 55 (+52.78%)
Mutual labels:  collectionview
KNBannerView
无限循环图片轮播器:本地图片,网络图片,混合图片(本地+网络) , 适配SDWebImage5.0 . 动态修改背景色,屏幕旋转适配
Stars: ✭ 82 (+127.78%)
Mutual labels:  collectionview
FavFighters
Xamarin.Forms goodlooking UI sample using the new SwipeView.
Stars: ✭ 32 (-11.11%)
Mutual labels:  collectionview

DDComponent

Make a collection controller to several components. A UICollectionView/UITableView framework for building fast and flexible lists. Like IGList.

中文文档

Requirements

  • Xcode 8.0+
  • iOS 8.0+

Installation

CocoaPods

pod 'DDComponent'

Carthage

github 'DDComponent'

Getting Started

For easy using, the api is similar to UICollectionView and UITableView.

@interface YourComponent : DDCollectionViewSectionComponent
@end

@implementation

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.size = CGSizeMake(DDComponentAutomaticDimension, 44);
        // config here. 
        // Remember self.collectionView is nil until it is added to root component.
    }
    return self;
}

- (void)prepareCollectionView {
    [super prepareCollectionView];
    // register your cell here.
}

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
    return 1;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return 1;
}

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
    return ... // Return your cell
}

@end

And the other api is also the same.

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    // select item
}
- (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath {
    // will display
}

Debug

po self.rootComponent
<DDCollectionViewRootComponent: 0x6080000bb900>
  [SubComponents]
    <DDComponentPodDemo.StatusComponent: 0x60800009b440>
      -[loading] <DDComponentPodDemo.StateComponent: 0x6080001651c0>
      *[normal] <DDCollectionViewSectionGroupComponent: 0x60800009acc0>
          [SubComponents]
            <DDComponentPodDemo.TaobaoBannerComponent: 0x6080001235c0>
            <DDComponentPodDemo.TaobaoEntriesComponent: 0x6080001524e0>
            <DDComponentPodDemo.TaobaoGoodsComponent: 0x608000151eb0>
            <DDComponentPodDemo.TaobaoGoodsComponent: 0x608000151510>
              [Header] <DDComponentPodDemo.HeaderComponent: 0x608000151250>
            <DDComponentPodDemo.TaobaoGoodsComponent: 0x608000152220>
            <DDComponentPodDemo.TaobaoGoodsComponent: 0x608000152380>
            <DDComponentPodDemo.TaobaoGoodsComponent: 0x6080001511a0>
            <DDComponentPodDemo.TaobaoGoodsComponent: 0x608000151b40>
              [Header] <DDComponentPodDemo.HeaderComponent: 0x608000151ca0>
            <DDComponentPodDemo.TaobaoGoodsComponent: 0x608000152170>
            <DDComponentPodDemo.TaobaoGoodsComponent: 0x6080001515c0>
            <DDComponentPodDemo.TaobaoGoodsComponent: 0x608000151a90>
              [Header] <DDComponentPodDemo.HeaderComponent: 0x608000151f60>
            <DDComponentPodDemo.TaobaoGoodsComponent: 0x608000151930>
            <DDComponentPodDemo.TaobaoGoodsComponent: 0x608000151670>
            <DDComponentPodDemo.TaobaoGoodsComponent: 0x608000152640>
      -[error] <DDComponentPodDemo.StateComponent: 0x608000165340>
      -[noData] <DDComponentPodDemo.StateComponent: 0x608000165400>

Structure

  1. View Component: displaying. for example, a list of cell or just an element。
  2. Container Component: combine the view components. For example, conbine some components as a list, or switch between different components(Loading, Error, Empty). And the root component is also a containter component.

An example how it

We need to do is only the red part.

Attension

Use size, inset first, then override the delegate api.

Some Question

As use the system api, indexPath is the UICollectionView's location. It is not the index of component's dataSource.

Revision

0.5.2 Optimize the numberOf. Add dataSource cache and collectionView cache.

0.5.1 Only support UICollectionView.

0.5.0 New DDComponent using Objective-C.

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