Skip to content

Commit

Permalink
Update documentation of ASNetworkImageNodeDelegate #trivial (#1163)
Browse files Browse the repository at this point in the history
`-imageNodeDidStartFetchingData:` and `-imageNodeDidFinishDecoding:` are always called on main thread, and the documentation should reflect that.
  • Loading branch information
nguyenhuy committed Oct 14, 2018
1 parent 17f24aa commit 7cdfacc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 11 additions & 9 deletions Source/ASNetworkImageNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,15 @@ NS_ASSUME_NONNULL_BEGIN
@protocol ASNetworkImageNodeDelegate <NSObject>
@optional

/**
* Notification that the image node started to load
*
* @param imageNode The sender.
*
* @discussion Called on the main thread.
*/
- (void)imageNodeDidStartFetchingData:(ASNetworkImageNode *)imageNode;

/**
* Notification that the image node finished downloading an image, with additional info.
* If implemented, this method will be called instead of `imageNode:didLoadImage:`.
Expand All @@ -167,15 +176,6 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)imageNode:(ASNetworkImageNode *)imageNode didLoadImage:(UIImage *)image;

/**
* Notification that the image node started to load
*
* @param imageNode The sender.
*
* @discussion Called on a background queue.
*/
- (void)imageNodeDidStartFetchingData:(ASNetworkImageNode *)imageNode;

/**
* Notification that the image node failed to download the image.
*
Expand All @@ -190,6 +190,8 @@ NS_ASSUME_NONNULL_BEGIN
* Notification that the image node finished decoding an image.
*
* @param imageNode The sender.
*
* @discussion Called on the main thread.
*/
- (void)imageNodeDidFinishDecoding:(ASNetworkImageNode *)imageNode;

Expand Down
2 changes: 2 additions & 0 deletions Source/ASNetworkImageNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,8 @@ - (void)_downloadImageWithCompletion:(void (^)(id <ASImageContainerProtocol> ima

- (void)_lazilyLoadImageIfNecessary
{
ASDisplayNodeAssertMainThread();

[self lock];
__weak id<ASNetworkImageNodeDelegate> delegate = _delegate;
BOOL delegateDidStartFetchingData = _delegateFlags.delegateDidStartFetchingData;
Expand Down

0 comments on commit 7cdfacc

Please sign in to comment.