mirror of
https://github.com/TextureGroup/Texture.git
synced 2026-04-07 19:17:39 +00:00
62 lines
1.7 KiB
Objective-C
62 lines
1.7 KiB
Objective-C
//
|
|
// TEBaseViewController.h
|
|
// Sample
|
|
//
|
|
// Created by Adlai Holler on 9/21/18.
|
|
// Copyright © 2018 Facebook. All rights reserved.
|
|
//
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
#import <AsyncDisplayKit/ASCollectionViewHelper.h>
|
|
|
|
#import "ui_collection_generated.h"
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
@class ASCollectionViewHelper;
|
|
|
|
static NSString *const TECellNativeReuseIdentifier = @"cell_id_native";
|
|
|
|
struct TEPath {
|
|
int section; // NSNotFound means "global."
|
|
int item; // NSNotFound means "section-level."
|
|
__unsafe_unretained NSString * _Nullable supplementaryElementKind; // Nil means item.
|
|
static TEPath make(NSIndexPath *indexPath, NSString *supplementaryElementKindArg = nil) {
|
|
return { (int)indexPath.section, (int)indexPath.item, supplementaryElementKindArg };
|
|
}
|
|
static TEPath header(NSInteger sectionArg) {
|
|
return { (int)sectionArg, 0, UICollectionElementKindSectionHeader };
|
|
}
|
|
static TEPath footer(NSInteger sectionArg) {
|
|
return { (int)sectionArg, 0, UICollectionElementKindSectionFooter };
|
|
}
|
|
};
|
|
|
|
@class TECellView, TEModel, TESectionController;
|
|
|
|
@interface TEBaseViewController : UIViewController <ASCollectionViewHelperDataSource> {
|
|
@package
|
|
ASCollectionViewHelper *_textureHelper;
|
|
}
|
|
|
|
/// Tell the view to reload data. Doesn't affect data source data.
|
|
- (void)reloadData;
|
|
|
|
/// Don't call on base class.
|
|
- (void)perform:(void(NS_NOESCAPE ^)(void))updates;
|
|
|
|
@end
|
|
|
|
@interface TEBaseViewController (UISubclassingHooks)
|
|
|
|
/// Things subclasses call:
|
|
- (NSInteger)numberOfSections;
|
|
- (NSInteger)numberOfItemsIn:(NSInteger)section;
|
|
- (CGSize)sizeAt:(const TEPath &)path;
|
|
- (void)hostItemAt:(const TEPath &)path in:(UIView *)contentView;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|