Skip to content

Commit f200f95

Browse files
committed
Merge pull request facebookarchive#248 from facebook/tidy-initialisers
Tidy initialisers.
2 parents 93bb7cd + fab6f62 commit f200f95

6 files changed

Lines changed: 19 additions & 30 deletions

File tree

AsyncDisplayKit/ASDisplayNode.h

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -45,31 +45,6 @@ typedef CALayer *(^ASDisplayNodeLayerBlock)();
4545
*/
4646
- (id)init;
4747

48-
/**
49-
* @abstract Alternative initializer with a view class.
50-
*
51-
* @param viewClass Any UIView subclass, such as UIScrollView.
52-
*
53-
* @return An ASDisplayNode instance whose view will be of class viewClass.
54-
*
55-
* @discussion If viewClass is not a subclass of _ASDisplayView, it will still render synchronously and -layout and
56-
* touch handling methods on the node will not be called.
57-
* The view instance will be created with alloc/init.
58-
*/
59-
- (id)initWithViewClass:(Class)viewClass;
60-
61-
/**
62-
* @abstract Alternative initializer with a layer class.
63-
*
64-
* @param layerClass Any CALayer subclass, such as CATransformLayer.
65-
*
66-
* @return An ASDisplayNode instance whose layer will be of class layerClass.
67-
*
68-
* @discussion If layerClass is not a subclass of _ASDisplayLayer, it will still render synchronously and -layout on the
69-
* node will not be called.
70-
* The layer instance will be created with alloc/init.
71-
*/
72-
- (id)initWithLayerClass:(Class)layerClass;
7348

7449
/**
7550
* @abstract Alternative initializer with a block to create the backing view.
@@ -263,8 +238,8 @@ typedef CALayer *(^ASDisplayNodeLayerBlock)();
263238
/**
264239
* @abstract Whether this node's view performs asynchronous rendering.
265240
*
266-
* @return Defaults to YES, except for synchronous views (ie, those created with -initWithViewClass: /
267-
* -initWithLayerClass:), which are always NO.
241+
* @return Defaults to YES, except for synchronous views (ie, those created with -initWithViewBlock: /
242+
* -initWithLayerBlock:), which are always NO.
268243
*
269244
* @discussion If this flag is set, then the node will participate in the current asyncdisplaykit_async_transaction and
270245
* do its rendering on the displayQueue instead of the main thread.

AsyncDisplayKit/Private/ASDisplayNodeInternal.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ typedef NS_OPTIONS(NSUInteger, ASDisplayNodeMethodOverrides) {
142142
// Returns the ancestor node that rasterizes descendants, or nil if none.
143143
- (ASDisplayNode *)__rasterizedContainerNode;
144144

145+
// Alternative initialiser for backing with a custom view class. Supports asynchronous display with _ASDisplayView subclasses.
146+
- (id)initWithViewClass:(Class)viewClass;
147+
148+
// Alternative initialiser for backing with a custom layer class. Supports asynchronous display with _ASDisplayLayer subclasses.
149+
- (id)initWithLayerClass:(Class)layerClass;
150+
145151
@property (nonatomic, assign) CGFloat contentsScaleForDisplay;
146152

147153
@end

AsyncDisplayKitTests/ASDisplayLayerTests.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ - (void)asyncdisplaykit_asyncTransactionContainerDidCompleteTransaction:(_ASAsyn
4848
@end
4949

5050

51+
@interface ASDisplayNode (HackForTests)
52+
- (id)initWithViewClass:(Class)viewClass;
53+
- (id)initWithLayerClass:(Class)layerClass;
54+
@end
55+
56+
5157
@interface _ASDisplayLayerTestLayer : _ASDisplayLayer
5258
{
5359
BOOL _isInCancelAsyncDisplay;

AsyncDisplayKitTests/ASDisplayNodeAppearanceTests.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ static dispatch_block_t modifyMethodByAddingPrologueBlockAndReturnCleanupBlock(C
4949

5050
@interface ASDisplayNode (PrivateStuffSoWeDontPullInCPPInternalH)
5151
- (BOOL)__visibilityNotificationsDisabled;
52+
- (id)initWithViewClass:(Class)viewClass;
53+
- (id)initWithLayerClass:(Class)layerClass;
5254
@end
5355

5456
@interface ASDisplayNodeAppearanceTests : XCTestCase

AsyncDisplayKitTests/ASDisplayNodeTests.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@
6161

6262

6363
@interface ASDisplayNode (HackForTests)
64-
6564
+ (dispatch_queue_t)asyncSizingQueue;
66-
65+
- (id)initWithViewClass:(Class)viewClass;
66+
- (id)initWithLayerClass:(Class)layerClass;
6767
@end
6868

6969
@interface ASTestDisplayNode : ASDisplayNode

Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ DEPENDENCIES:
77
SPEC CHECKSUMS:
88
OCMock: 6db79185520e24f9f299548f2b8b07e41d881bd5
99

10-
COCOAPODS: 0.34.4
10+
COCOAPODS: 0.35.0

0 commit comments

Comments
 (0)