Revert "Route setDelegate: to setAsyncDelegate: (#3007)" (#3023)

This reverts commit 5c8818d107.
This commit is contained in:
Adlai Holler
2017-02-13 10:38:19 -08:00
committed by GitHub
parent ec59c3161a
commit 0badff651a
5 changed files with 17 additions and 16 deletions

View File

@@ -125,9 +125,6 @@ NS_ASSUME_NONNULL_BEGIN
@interface ASCollectionView (Deprecated)
@property (nonatomic, weak) id<UICollectionViewDelegate> delegate ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode.delegate instead. If you REALLY want to use this, cast to a UICollectionView but don't rely on the return value.");
@property (nonatomic, weak) id<UICollectionViewDataSource> dataSource ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode.dataSource instead. If you REALLY want to use this, cast to a UICollectionView but don't rely on the return value.");
/**
* The object that acts as the asynchronous delegate of the collection view
*

View File

@@ -367,10 +367,8 @@ static NSString * const kReuseIdentifier = @"_ASCollectionReuseIdentifier";
- (void)setDelegate:(id<UICollectionViewDelegate>)delegate
{
// The compiler will prevent users from calling this,
// but we will automatically route to @c asyncDelegate
// to support interop with frameworks like TLYShyNavBar.
self.asyncDelegate = (id<ASCollectionDelegate>)delegate;
// Our UIScrollView superclass sets its delegate to nil on dealloc. Only assert if we get a non-nil value here. We also allow this when we're doing interop.
ASDisplayNodeAssert(_asyncDelegateFlags.interop || delegate == nil, @"ASCollectionView uses asyncDelegate, not UICollectionView's delegate property.");
}
- (void)proxyTargetHasDeallocated:(ASDelegateProxy *)proxy

View File

@@ -69,9 +69,6 @@ NS_ASSUME_NONNULL_BEGIN
@interface ASTableView (Deprecated)
@property (nonatomic, weak) id<UITableViewDelegate> delegate ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode.delegate instead. If you REALLY want to use this, cast to UITableView but don't rely on the return value.");
@property (nonatomic, weak) id<UITableViewDataSource> dataSource ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode.dataSource instead. If you REALLY want to use this, cast to UITableView but don't rely on the return value.");
@property (nonatomic, weak) id<ASTableDelegate> asyncDelegate ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's .delegate property instead.");
@property (nonatomic, weak) id<ASTableDataSource> asyncDataSource ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode .dataSource property instead.");

View File

@@ -337,10 +337,8 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
- (void)setDelegate:(id<UITableViewDelegate>)delegate
{
// The compiler will prevent users from calling this,
// but we will automatically route to @c asyncDelegate
// to support interop with frameworks like TLYShyNavBar.
self.asyncDelegate = (id<ASTableDelegate>)delegate;
// Our UIScrollView superclass sets its delegate to nil on dealloc. Only assert if we get a non-nil value here.
ASDisplayNodeAssert(delegate == nil, @"ASTableView uses asyncDelegate, not UITableView's delegate property.");
}
- (id<ASTableDataSource>)asyncDataSource
@@ -357,7 +355,7 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
// the (common) case of nilling the asyncDataSource in the ViewController's dealloc. In this case our _asyncDataSource
// will return as nil (ARC magic) even though the _proxyDataSource still exists. It's really important to hold a strong
// reference to the old dataSource in this case because calls to ASTableViewProxy will start failing and cause crashes.
NS_VALID_UNTIL_END_OF_SCOPE id oldDataSource = super.dataSource;
NS_VALID_UNTIL_END_OF_SCOPE id oldDataSource = self.dataSource;
if (asyncDataSource == nil) {
_asyncDataSource = nil;

View File

@@ -228,6 +228,17 @@ class MosaicCollectionViewLayoutInspector: NSObject, ASCollectionViewLayoutInspe
return ASSizeRange.init(min: CGSize.zero, max: layout._headerSizeForSection(section: atIndexPath.section))
}
/**
* Asks the inspector for the number of supplementary sections in the collection view for the given kind.
*/
func collectionView(_ collectionView: ASCollectionView, numberOfSectionsForSupplementaryNodeOfKind kind: String) -> UInt {
if (kind == UICollectionElementKindSectionHeader) {
return UInt((collectionView.dataSource?.numberOfSections!(in: collectionView))!)
} else {
return 0
}
}
/**
* Asks the inspector for the number of supplementary views for the given kind in the specified section.
*/
@@ -240,6 +251,6 @@ class MosaicCollectionViewLayoutInspector: NSObject, ASCollectionViewLayoutInspe
}
func scrollableDirections() -> ASScrollDirection {
return ASScrollDirectionVerticalDirections
return ASScrollDirectionVerticalDirections;
}
}