mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
[ASNetworkImageNode] Assert if both URL and image are set (#2782)
* [ASNetworkImageNode] Assert if both URL and image are set Here's one other idea for addressing this problem. Essentially, we assert if you've set both the URL and the image. I've played around with Pinterest and there's only one case where we hit this (the transition). So I've also added another method (which is a bummer, it's weird I know) but there's one good reason to add this method, ephemeralImage, which is the user doesn't have to manually clear it out like they would if they used defaultImage to save memory. Putting this up for discussion. * Fix comment * Oh yeah, @dynamic, thanks @adlai * Remove ephemeralImage
This commit is contained in:
@@ -51,17 +51,18 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* The image to display.
|
||||
*
|
||||
* @discussion Setting an image to the image property of an ASNetworkImageNode will cause it to act like a plain
|
||||
* ASImageNode if a URL is not set as well. As soon as the URL is set the ASNetworkImageNode will act like an
|
||||
* ASNetworkImageNode and the image property will be managed internally. This means the image property will be cleared
|
||||
* out and replaced by the placeholder (<defaultImage>) image while loading and the final image after the new image
|
||||
* data was downloaded and processed. If you want to use a placholder image, use the defaultImage property
|
||||
* instead.
|
||||
* @discussion By setting an image to the image property the ASNetworkImageNode will act like a plain ASImageNode.
|
||||
* As soon as the URL is set the ASNetworkImageNode will act like an ASNetworkImageNode and the image property
|
||||
* will be managed internally. This means the image property will be cleared out and replaced by the placeholder
|
||||
* (<defaultImage>) image while loading and the final image after the new image data was downloaded and processed.
|
||||
* If you want to use a placholder image functionality use the defaultImage property instead.
|
||||
*/
|
||||
@property (nullable, nonatomic, strong) UIImage *image;
|
||||
|
||||
/**
|
||||
* A placeholder image to display while the URL is loading.
|
||||
* A placeholder image to display while the URL is loading. This is slightly different than placeholderImage in the
|
||||
* ASDisplayNode superclass as defaultImage will *not* be displayed synchronously. If you wish to have the image
|
||||
* displayed synchronously, use @c placeholderImage.
|
||||
*/
|
||||
@property (nullable, nonatomic, strong, readwrite) UIImage *defaultImage;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user