Skip to content
This repository was archived by the owner on May 3, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Pod/Source/AFNetworking/DFAFImageFetcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ extern NSString *__nonnull const DFAFRequestCachePolicyKey;
/*! A set containing all the supported URL schemes. The default set contains "http", "https", "ftp", "file" and "data" schemes.
@note The property can be changed in case there are any custom protocols supported by NSURLSession.
*/
@property (nonnull, nonatomic, copy) NSSet *supportedSchemes;
@property (nonnull, nonatomic, copy) NSSet<NSString *> *supportedSchemes;

/*! Initializes the DFURLImageFetcher with a given session manager.
*/
Expand Down
2 changes: 1 addition & 1 deletion Pod/Source/Core/Managing/DFCompositeImageManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

/*! Initializes composite image manager with an array of image managers.
*/
- (nonnull instancetype)initWithImageManagers:(nonnull NSArray /* id<DFImageManaging> */ *)imageManagers;
- (nonnull instancetype)initWithImageManagers:(nonnull NSArray<id<DFImageManaging>> *)imageManagers;

/*! Adds image manager to the end of the chain.
*/
Expand Down
6 changes: 3 additions & 3 deletions Pod/Source/Core/Managing/DFCompositeImageManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
__df_outManager; })

@implementation DFCompositeImageManager {
NSMutableArray /* id<DFImageManaging> */ *_managers;
NSMutableArray<id<DFImageManaging>> *_managers;
}

- (nonnull instancetype)init {
Expand All @@ -26,7 +26,7 @@ - (nonnull instancetype)init {
return self;
}

- (nonnull instancetype)initWithImageManagers:(nonnull NSArray *)imageManagers {
- (nonnull instancetype)initWithImageManagers:(nonnull NSArray<id<DFImageManaging>> *)imageManagers {
if (self = [self init]) {
[_managers addObjectsFromArray:imageManagers];
}
Expand Down Expand Up @@ -59,7 +59,7 @@ - (nonnull DFImageTask *)imageTaskForRequest:(nonnull DFImageRequest *)request c
return [manager imageTaskForRequest:request completion:completion];
}

- (void)getImageTasksWithCompletion:(void (^ __nullable)(NSArray * __nonnull, NSArray * __nonnull))completion {
- (void)getImageTasksWithCompletion:(void (^ __nullable)(NSArray<DFImageTask *> * __nonnull, NSArray<DFImageTask *> * __nonnull))completion {
NSMutableArray *allTasks = [NSMutableArray new];
NSMutableArray *allPreheatingTasks = [NSMutableArray new];
NSInteger __block numberOfCallbacks = (NSInteger)_managers.count;
Expand Down
6 changes: 3 additions & 3 deletions Pod/Source/Core/Protocols/DFImageManaging.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ typedef void (^DFImageTaskCompletion)(UIImage *__nullable image, NSError *__null

/*! Asynchronously calls a completion block on the main thread with all resumed outstanding image tasks and separate array with all preheating tasks.
*/
- (void)getImageTasksWithCompletion:(void (^__nullable)(NSArray *__nonnull tasks, NSArray *__nonnull preheatingTasks))completion;
- (void)getImageTasksWithCompletion:(void (^__nullable)(NSArray<DFImageTask *> *__nonnull tasks, NSArray<DFImageTask *> *__nonnull preheatingTasks))completion;

/*! Cancels all outstanding requests, including preheating requests, and then invalidates the image manager. New image tasks may not be started.
*/
Expand All @@ -45,12 +45,12 @@ typedef void (^DFImageTaskCompletion)(UIImage *__nullable image, NSError *__null
@note DFImageManager caches images with the exact target size, content mode, and options you specify in this method. If you later request an image with, for example, a different target size than you passed when calling this method, DFImageManager might have to generate a new image but would still be able to use cached image data.
@note If this method is called twice with the same requests the second call would have no effect (unless first requests are completed).
*/
- (void)startPreheatingImagesForRequests:(nonnull NSArray /* DFImageRequest */ *)requests;
- (void)startPreheatingImagesForRequests:(nonnull NSArray<DFImageRequest *> *)requests;

/*! Cancels preheating for the given requests.
@note The request parameters shall exactly match the parameters used in startPreheatingImagesForRequests: method.
*/
- (void)stopPreheatingImagesForRequests:(nonnull NSArray /* DFImageRequest */ *)requests;
- (void)stopPreheatingImagesForRequests:(nonnull NSArray<DFImageRequest *> *)requests;

/*! Cancels all image preheating tasks registered with a manager.
*/
Expand Down
2 changes: 1 addition & 1 deletion Pod/Source/NSURLSession/DFURLHTTPResponseValidator.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
/*! The acceptable MIME types for responses. Default value is nil so that all content types are supported. Image initialization never crashes when provided with an invalid data.
@note All content types are acceptable in case acceptableContentTypes is nil.
*/
@property (nullable, nonatomic, copy) NSSet *acceptableContentTypes;
@property (nullable, nonatomic, copy) NSSet<NSString *> *acceptableContentTypes;

@end
2 changes: 1 addition & 1 deletion Pod/Source/NSURLSession/DFURLImageFetcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ extern NSString *const DFURLRequestCachePolicyKey;
/*! A set containing all the supported URL schemes. The default set contains "http", "https", "ftp", "file" and "data" schemes.
@note The property can be changed in case there are any custom protocols supported by NSURLSession.
*/
@property (nonatomic, copy) NSSet *supportedSchemes;
@property (nonatomic, copy) NSSet<NSString *> *supportedSchemes;

/*! The delegate of the receiver.
*/
Expand Down
6 changes: 3 additions & 3 deletions Pod/Source/UI/DFCollectionViewPreheatingController.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
@param addedIndexPaths Index paths for items added to the preheat window. Index paths are sorted so that the items closest to the previous preheat window are in the beginning of the array; no matter whether user is scrolling forward of backward.
@param removedIndexPaths Index paths for items there were removed from the preheat window.
*/
- (void)collectionViewPreheatingController:(DFCollectionViewPreheatingController *)controller didUpdatePreheatRectWithAddedIndexPaths:(NSArray *)addedIndexPaths removedIndexPaths:(NSArray *)removedIndexPaths;
- (void)collectionViewPreheatingController:(DFCollectionViewPreheatingController *)controller didUpdatePreheatRectWithAddedIndexPaths:(NSArray<NSIndexPath *> *)addedIndexPaths removedIndexPaths:(NSArray<NSIndexPath *> *)removedIndexPaths;

@end

Expand All @@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN
*/
@interface DFCollectionViewPreheatingController : NSObject

/*! The collection view the receiver was initializer with.
/*! The collection view the receiver was initialized with.
*/
@property (nonatomic, readonly) UICollectionView *collectionView;

Expand Down Expand Up @@ -53,7 +53,7 @@ NS_ASSUME_NONNULL_BEGIN

/*! Returns current preheat indexes.
*/
@property (nonatomic, readonly) NSSet *preheatIndexPaths;
@property (nonatomic, readonly) NSSet<NSIndexPath *> *preheatIndexPaths;

/*! Initializes preheating controller with a collection view.
@param collectionView Collection view.
Expand Down
8 changes: 4 additions & 4 deletions Pod/Source/UI/DFCollectionViewPreheatingController.m
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ - (void)_updatePreheatRect {

_preheatIndexPaths = newIndexPaths;

NSArray *sortedAddedIndexPaths = [addedIndexPaths.allObjects sortedArrayUsingDescriptors:@[ [NSSortDescriptor sortDescriptorWithKey:@"section" ascending:isScrollingForward], [NSSortDescriptor sortDescriptorWithKey:@"item" ascending:isScrollingForward] ]];
NSArray<NSIndexPath *> *sortedAddedIndexPaths = [addedIndexPaths.allObjects sortedArrayUsingDescriptors:@[ [NSSortDescriptor sortDescriptorWithKey:@"section" ascending:isScrollingForward], [NSSortDescriptor sortDescriptorWithKey:@"item" ascending:isScrollingForward] ]];

_preheatRect = preheatRect;

Expand Down Expand Up @@ -111,9 +111,9 @@ - (CGRect)_preheatRectForScrollingForward:(BOOL)forward {
return CGRectIntegral(preheatRect);
}

- (NSArray *)_indexPathsForElementsInRect:(CGRect)rect {
NSArray *allLayoutAttributes = [self.collectionView.collectionViewLayout layoutAttributesForElementsInRect:rect];
NSMutableArray *indexPaths = [NSMutableArray new];
- (NSArray<NSIndexPath *> *)_indexPathsForElementsInRect:(CGRect)rect {
NSArray<UICollectionViewLayoutAttributes *> *allLayoutAttributes = [self.collectionView.collectionViewLayout layoutAttributesForElementsInRect:rect];
NSMutableArray<NSIndexPath *> *indexPaths = [NSMutableArray new];
for (UICollectionViewLayoutAttributes *attributes in allLayoutAttributes) {
if (attributes.representedElementCategory == UICollectionElementCategoryCell) {
[indexPaths addObject:attributes.indexPath];
Expand Down