Skip to content

Commit ad57e12

Browse files
Simple UIScrollView wrapper node.
Closes facebookarchive#99. This is a quick sketch -- room for improvement includes considering a less-questionable class name, potentially exposing additional UIScrollView functionality directly on the node, and using it in a sample project.
1 parent 0a5ba09 commit ad57e12

4 files changed

Lines changed: 56 additions & 0 deletions

File tree

AsyncDisplayKit.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@
149149
AC3C4A511A1139C100143C57 /* ASCollectionView.h in Headers */ = {isa = PBXBuildFile; fileRef = AC3C4A4F1A1139C100143C57 /* ASCollectionView.h */; settings = {ATTRIBUTES = (Public, ); }; };
150150
AC3C4A521A1139C100143C57 /* ASCollectionView.mm in Sources */ = {isa = PBXBuildFile; fileRef = AC3C4A501A1139C100143C57 /* ASCollectionView.mm */; };
151151
AC3C4A541A113EEC00143C57 /* ASCollectionViewProtocols.h in Headers */ = {isa = PBXBuildFile; fileRef = AC3C4A531A113EEC00143C57 /* ASCollectionViewProtocols.h */; settings = {ATTRIBUTES = (Public, ); }; };
152+
D785F6621A74327E00291744 /* ASScrollNode.h in Headers */ = {isa = PBXBuildFile; fileRef = D785F6601A74327E00291744 /* ASScrollNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
153+
D785F6631A74327E00291744 /* ASScrollNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = D785F6611A74327E00291744 /* ASScrollNode.mm */; };
152154
DB7121BCD50849C498C886FB /* libPods-AsyncDisplayKitTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EFA731F0396842FF8AB635EE /* libPods-AsyncDisplayKitTests.a */; };
153155
/* End PBXBuildFile section */
154156

@@ -294,6 +296,8 @@
294296
AC3C4A501A1139C100143C57 /* ASCollectionView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASCollectionView.mm; sourceTree = "<group>"; };
295297
AC3C4A531A113EEC00143C57 /* ASCollectionViewProtocols.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASCollectionViewProtocols.h; sourceTree = "<group>"; };
296298
D3779BCFF841AD3EB56537ED /* Pods-AsyncDisplayKitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AsyncDisplayKitTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-AsyncDisplayKitTests/Pods-AsyncDisplayKitTests.release.xcconfig"; sourceTree = "<group>"; };
299+
D785F6601A74327E00291744 /* ASScrollNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASScrollNode.h; sourceTree = "<group>"; };
300+
D785F6611A74327E00291744 /* ASScrollNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASScrollNode.mm; sourceTree = "<group>"; };
297301
EFA731F0396842FF8AB635EE /* libPods-AsyncDisplayKitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AsyncDisplayKitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
298302
FB07EABBCF28656C6297BC2D /* Pods-AsyncDisplayKitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AsyncDisplayKitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-AsyncDisplayKitTests/Pods-AsyncDisplayKitTests.debug.xcconfig"; sourceTree = "<group>"; };
299303
/* End PBXFileReference section */
@@ -389,6 +393,8 @@
389393
AC3C4A501A1139C100143C57 /* ASCollectionView.mm */,
390394
055F1A3A19ABD43F004DAFF1 /* ASCellNode.h */,
391395
055F1A3B19ABD43F004DAFF1 /* ASCellNode.m */,
396+
D785F6601A74327E00291744 /* ASScrollNode.h */,
397+
D785F6611A74327E00291744 /* ASScrollNode.mm */,
392398
058D09E1195D050800B7D73C /* Details */,
393399
058D0A01195D050800B7D73C /* Private */,
394400
058D09B2195D04C000B7D73C /* Supporting Files */,
@@ -611,6 +617,7 @@
611617
055B9FA81A1C154B00035D6D /* ASNetworkImageNode.h in Headers */,
612618
054963491A1EA066000F8E56 /* ASBasicImageDownloader.h in Headers */,
613619
AC3C4A541A113EEC00143C57 /* ASCollectionViewProtocols.h in Headers */,
620+
D785F6621A74327E00291744 /* ASScrollNode.h in Headers */,
614621
0587F9BD1A7309ED00AFF0BA /* ASEditableTextNode.h in Headers */,
615622
05F20AA41A15733C00DCA68A /* ASImageProtocols.h in Headers */,
616623
058D0A71195D05F800B7D73C /* _AS-objc-internal.h in Headers */,
@@ -788,6 +795,7 @@
788795
058D0A29195D050800B7D73C /* ASDisplayNode+DebugTiming.mm in Sources */,
789796
058D0A22195D050800B7D73C /* _ASAsyncTransaction.m in Sources */,
790797
055F1A3919ABD413004DAFF1 /* ASRangeController.mm in Sources */,
798+
D785F6631A74327E00291744 /* ASScrollNode.mm in Sources */,
791799
);
792800
runOnlyForDeploymentPostprocessing = 0;
793801
};

AsyncDisplayKit/ASScrollNode.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* Copyright (c) 2014-present, Facebook, Inc.
2+
* All rights reserved.
3+
*
4+
* This source code is licensed under the BSD-style license found in the
5+
* LICENSE file in the root directory of this source tree. An additional grant
6+
* of patent rights can be found in the PATENTS file in the same directory.
7+
*/
8+
9+
#import <AsyncDisplayKit/ASDisplayNode.h>
10+
11+
#import <UIKit/UIKit.h>
12+
13+
/**
14+
* Simple node that wraps UIScrollView.
15+
*/
16+
@interface ASScrollNode : ASDisplayNode
17+
18+
/**
19+
* @abstract The node's UIScrollView.
20+
*/
21+
@property (nonatomic, readonly, strong) UIScrollView *view;
22+
23+
@end

AsyncDisplayKit/ASScrollNode.mm

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* Copyright (c) 2014-present, Facebook, Inc.
2+
* All rights reserved.
3+
*
4+
* This source code is licensed under the BSD-style license found in the
5+
* LICENSE file in the root directory of this source tree. An additional grant
6+
* of patent rights can be found in the PATENTS file in the same directory.
7+
*/
8+
9+
#import "ASScrollNode.h"
10+
11+
#import "ASDisplayNodeInternal.h"
12+
13+
@implementation ASScrollNode
14+
15+
- (instancetype)init
16+
{
17+
if (!(self = [super initWithViewClass:UIScrollView.class]))
18+
return nil;
19+
20+
return self;
21+
}
22+
23+
@end

AsyncDisplayKit/AsyncDisplayKit.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@
2020
#import <AsyncDisplayKit/ASTableView.h>
2121
#import <AsyncDisplayKit/ASCollectionView.h>
2222
#import <AsyncDisplayKit/ASCellNode.h>
23+
24+
#import <AsyncDisplayKit/ASScrollNode.h>

0 commit comments

Comments
 (0)