mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-07 05:02:56 +00:00
* Separate dataSource & UIKit index spaces Beef up our supplementary node support Make the API way better Go nuts Add a unit test for UICollectionView's handling of reloadData inside batch updates Wrap indexPathForNode: in a cache Convert index paths in delegate methods Go back on table view Put collection view back Switch up the API Move most ASCollectionView API to ASCollectionNode Move most table logic over to ASTableNode Do the things More conversion work Keep on keepin' on Get table view delegate API done More porting Simplify Clear the delegate More cleanup Move more stuff around Remove pointless file Re-add some API Put back more API Use the right flag * Some cleanup * Remove incorrect comment * Tweak the API * Put back a couple methods * update example projects (note: ASCollectionView deprecation warnings expected) * change reloadDataWithCompletion:nil --> reloadData * Clean up rebase * Make deprecated numberOfItemsInSection methods optional * Use the right flag * Address nits * update ASDKTube, ASDKgram & ASViewController examples
81 lines
3.4 KiB
Objective-C
81 lines
3.4 KiB
Objective-C
//
|
|
// ASMultidimensionalArrayUtils.h
|
|
// AsyncDisplayKit
|
|
//
|
|
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
|
// This source code is licensed under the BSD-style license found in the
|
|
// LICENSE file in the root directory of this source tree. An additional grant
|
|
// of patent rights can be found in the PATENTS file in the same directory.
|
|
//
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
#import <AsyncDisplayKit/ASBaseDefines.h>
|
|
|
|
|
|
/**
|
|
* Helper class for operation on multidimensional array, where the object of array may be an object or an array.
|
|
*/
|
|
|
|
ASDISPLAYNODE_EXTERN_C_BEGIN
|
|
|
|
/**
|
|
* Deep mutable copy of an array that contains arrays, which contain objects. It will go one level deep into the array to copy.
|
|
* This method is substantially faster than the generalized version, e.g. about 10x faster, so use it whenever it fits the need.
|
|
*/
|
|
extern NSMutableArray<NSMutableArray *> *ASTwoDimensionalArrayDeepMutableCopy(NSArray<NSArray *> *array) AS_WARN_UNUSED_RESULT;
|
|
|
|
/**
|
|
* Deep mutable copy of multidimensional array. This is completely generalized and supports copying mixed-depth arrays,
|
|
* where some subarrays might contain both elements and other subarrays. It will recursively do the multiple copy for each subarray.
|
|
*/
|
|
extern NSObject<NSCopying> *ASMultidimensionalArrayDeepMutableCopy(NSObject<NSCopying> *obj) AS_WARN_UNUSED_RESULT;
|
|
|
|
/**
|
|
* Insert the elements into the mutable multidimensional array at given index paths.
|
|
*/
|
|
extern void ASInsertElementsIntoMultidimensionalArrayAtIndexPaths(NSMutableArray *mutableArray, NSArray *indexPaths, NSArray *elements);
|
|
|
|
/**
|
|
* Delete the elements of the mutable multidimensional array at given index paths
|
|
*/
|
|
extern void ASDeleteElementsInMultidimensionalArrayAtIndexPaths(NSMutableArray *mutableArray, NSArray *indexPaths);
|
|
|
|
/**
|
|
* Find the elements of the mutable multidimensional array at given index paths.
|
|
*/
|
|
extern NSArray *ASFindElementsInMultidimensionalArrayAtIndexPaths(NSMutableArray *mutableArray, NSArray *indexPaths) AS_WARN_UNUSED_RESULT;
|
|
|
|
/**
|
|
* Return all the index paths of mutable multidimensional array at given index set, in ascending order.
|
|
*/
|
|
extern NSArray *ASIndexPathsForMultidimensionalArrayAtIndexSet(NSArray *multidimensionalArray, NSIndexSet *indexSet) AS_WARN_UNUSED_RESULT;
|
|
|
|
/**
|
|
* Moves the object at `sourceIndexPath` to `destinationIndexPath`.
|
|
*/
|
|
extern void ASMoveElementInTwoDimensionalArray(NSMutableArray *mutableArray, NSIndexPath *sourceIndexPath, NSIndexPath *destinationIndexPath);
|
|
|
|
/**
|
|
* Return the index paths of the given multidimensional array that are present in the given index paths array.
|
|
*/
|
|
extern NSArray<NSIndexPath *> *ASIndexPathsInMultidimensionalArrayIntersectingIndexPaths(NSArray *multidimensionalArray, NSArray<NSIndexPath *> *indexPaths) AS_WARN_UNUSED_RESULT;
|
|
|
|
/**
|
|
* Return all the index paths of a two-dimensional array, in ascending order.
|
|
*/
|
|
extern NSArray *ASIndexPathsForTwoDimensionalArray(NSArray <NSArray *>* twoDimensionalArray) AS_WARN_UNUSED_RESULT;
|
|
|
|
/**
|
|
* Return all the index paths of a multidimensional array, in ascending order.
|
|
*/
|
|
extern NSArray *ASIndexPathsForMultidimensionalArray(NSArray *MultidimensionalArray) AS_WARN_UNUSED_RESULT;
|
|
|
|
/**
|
|
* Attempt to get the object at the given index path. Returns @c nil if the index path is out of bounds.
|
|
*/
|
|
extern id ASGetElementInTwoDimensionalArray(NSArray *array, NSIndexPath *indexPath) AS_WARN_UNUSED_RESULT;
|
|
|
|
|
|
ASDISPLAYNODE_EXTERN_C_END
|