Merge pull request #248 from facebook/tidy-initialisers

Tidy initialisers.
This commit is contained in:
Ryan Nystrom 2015-01-26 11:11:08 -08:00
commit f200f9504a
6 changed files with 19 additions and 30 deletions

View File

@ -45,31 +45,6 @@ typedef CALayer *(^ASDisplayNodeLayerBlock)();
*/
- (id)init;
/**
* @abstract Alternative initializer with a view class.
*
* @param viewClass Any UIView subclass, such as UIScrollView.
*
* @return An ASDisplayNode instance whose view will be of class viewClass.
*
* @discussion If viewClass is not a subclass of _ASDisplayView, it will still render synchronously and -layout and
* touch handling methods on the node will not be called.
* The view instance will be created with alloc/init.
*/
- (id)initWithViewClass:(Class)viewClass;
/**
* @abstract Alternative initializer with a layer class.
*
* @param layerClass Any CALayer subclass, such as CATransformLayer.
*
* @return An ASDisplayNode instance whose layer will be of class layerClass.
*
* @discussion If layerClass is not a subclass of _ASDisplayLayer, it will still render synchronously and -layout on the
* node will not be called.
* The layer instance will be created with alloc/init.
*/
- (id)initWithLayerClass:(Class)layerClass;
/**
* @abstract Alternative initializer with a block to create the backing view.
@ -263,8 +238,8 @@ typedef CALayer *(^ASDisplayNodeLayerBlock)();
/**
* @abstract Whether this node's view performs asynchronous rendering.
*
* @return Defaults to YES, except for synchronous views (ie, those created with -initWithViewClass: /
* -initWithLayerClass:), which are always NO.
* @return Defaults to YES, except for synchronous views (ie, those created with -initWithViewBlock: /
* -initWithLayerBlock:), which are always NO.
*
* @discussion If this flag is set, then the node will participate in the current asyncdisplaykit_async_transaction and
* do its rendering on the displayQueue instead of the main thread.

View File

@ -142,6 +142,12 @@ typedef NS_OPTIONS(NSUInteger, ASDisplayNodeMethodOverrides) {
// Returns the ancestor node that rasterizes descendants, or nil if none.
- (ASDisplayNode *)__rasterizedContainerNode;
// Alternative initialiser for backing with a custom view class. Supports asynchronous display with _ASDisplayView subclasses.
- (id)initWithViewClass:(Class)viewClass;
// Alternative initialiser for backing with a custom layer class. Supports asynchronous display with _ASDisplayLayer subclasses.
- (id)initWithLayerClass:(Class)layerClass;
@property (nonatomic, assign) CGFloat contentsScaleForDisplay;
@end

View File

@ -48,6 +48,12 @@ static UIImage *bogusImage() {
@end
@interface ASDisplayNode (HackForTests)
- (id)initWithViewClass:(Class)viewClass;
- (id)initWithLayerClass:(Class)layerClass;
@end
@interface _ASDisplayLayerTestLayer : _ASDisplayLayer
{
BOOL _isInCancelAsyncDisplay;

View File

@ -49,6 +49,8 @@ static dispatch_block_t modifyMethodByAddingPrologueBlockAndReturnCleanupBlock(C
@interface ASDisplayNode (PrivateStuffSoWeDontPullInCPPInternalH)
- (BOOL)__visibilityNotificationsDisabled;
- (id)initWithViewClass:(Class)viewClass;
- (id)initWithLayerClass:(Class)layerClass;
@end
@interface ASDisplayNodeAppearanceTests : XCTestCase

View File

@ -61,9 +61,9 @@ for (ASDisplayNode *n in @[ nodes ]) {\
@interface ASDisplayNode (HackForTests)
+ (dispatch_queue_t)asyncSizingQueue;
- (id)initWithViewClass:(Class)viewClass;
- (id)initWithLayerClass:(Class)layerClass;
@end
@interface ASTestDisplayNode : ASDisplayNode

View File

@ -7,4 +7,4 @@ DEPENDENCIES:
SPEC CHECKSUMS:
OCMock: 6db79185520e24f9f299548f2b8b07e41d881bd5
COCOAPODS: 0.34.4
COCOAPODS: 0.35.0