diff --git a/AsyncDisplayKit/ASNetworkImageNode.h b/AsyncDisplayKit/ASNetworkImageNode.h index 59a74ec7c3..e6ed744184 100644 --- a/AsyncDisplayKit/ASNetworkImageNode.h +++ b/AsyncDisplayKit/ASNetworkImageNode.h @@ -29,10 +29,16 @@ * * @discussion If `cache` is nil, the receiver will not attempt to retrieve images from a cache before downloading them. * - * @result An initialized ASNetworkImageNode. + * @returns An initialized ASNetworkImageNode. */ - (instancetype)initWithCache:(id)cache downloader:(id)downloader; -- (instancetype)init NS_UNAVAILABLE; + +/** + * Convenience initialiser. + * + * @returns An ASNetworkImageNode configured to use the NSURLSession-powered ASBasicImageDownloader, and no extra cache. + */ +- (instancetype)init; /** * The delegate, which must conform to the protocol. diff --git a/AsyncDisplayKit/ASNetworkImageNode.mm b/AsyncDisplayKit/ASNetworkImageNode.mm index 7e34c630cf..8e7f5e2e3c 100644 --- a/AsyncDisplayKit/ASNetworkImageNode.mm +++ b/AsyncDisplayKit/ASNetworkImageNode.mm @@ -8,8 +8,9 @@ #import "ASNetworkImageNode.h" -#import -#import +#import "ASBasicImageDownloader.h" +#import "ASDisplayNode+Subclasses.h" +#import "ASThread.h" @interface ASNetworkImageNode () @@ -49,7 +50,7 @@ - (instancetype)init { - ASDISPLAYNODE_NOT_DESIGNATED_INITIALIZER(); + return [self initWithCache:nil downloader:[[ASBasicImageDownloader alloc] init]]; } - (void)dealloc diff --git a/examples/Kittens/Sample/KittenNode.m b/examples/Kittens/Sample/KittenNode.m index f87d5118a3..6b9b6f085a 100644 --- a/examples/Kittens/Sample/KittenNode.m +++ b/examples/Kittens/Sample/KittenNode.m @@ -74,7 +74,7 @@ static const CGFloat kInnerPadding = 10.0f; _kittenSize = size; // kitten image, with a purple background colour serving as placeholder - _imageNode = [[ASNetworkImageNode alloc] initWithCache:nil downloader:[[ASBasicImageDownloader alloc] init]]; + _imageNode = [[ASNetworkImageNode alloc] init]; _imageNode.backgroundColor = [UIColor purpleColor]; _imageNode.URL = [NSURL URLWithString:[NSString stringWithFormat:@"http://placekitten.com/%zd/%zd", (NSInteger)roundl(_kittenSize.width),