View gist:ae2b051225208ec4d871
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface DFImageActivityItemProvider : UIActivityItemProvider | |
- (instancetype)initWithPlaceholderItem:(id)placeholderItem request:(DFImageRequest *)request; | |
@end | |
@implementation DFImageActivityItemProvider { | |
DFImageRequest *_request; | |
DFImageRequestID *_requestID; | |
} |
View DFCompositeImageTask
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DFCompositeImageTask.h | |
#import "DFImageManagerDefines.h" | |
#import <Foundation/Foundation.h> | |
#import <UIKit/UIKit.h> | |
@class DFCompositeImageTask; | |
@class DFImageRequest; | |
@class DFImageTask; | |
@protocol DFImageManaging; |
View DFProxyImageManager
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DFProxyImageManager.h | |
#import "DFImageManaging.h" | |
#import "DFImageRequest.h" | |
#import <Foundation/Foundation.h> | |
/*! The DFProxyRequestTransforming protocol defines an interface for transforming application-specific classes or protocols to the resources supported by the DFImageManager. | |
*/ | |
@protocol DFProxyRequestTransforming <NSObject> |
View gist:511d247fad4d6f76254a
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface ViewController : UIViewController | |
@property (nonatomic, readonly, nullable) UIView *keyboardAnchorView; | |
@property (nonatomic, readonly, nullable) NSLayoutConstraint *keyboardAnchorViewHeightConstraint; | |
@end | |
@implementation |
View CustomImageLoadingView.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import DFImageManager; | |
@interface CustomImageLoadingView | |
- (void)prepareForReuse; | |
- (void)setImageWithRequest:(nonnull DFImageRequest *)request; | |
@end | |
@implementation CustomImageLoadingView { |
View XCTestCaseExtensions.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The MIT License (MIT) | |
// | |
// Copyright (c) 2015 Alexander Grebenyuk (github.com/kean). | |
import XCTest | |
import Foundation | |
extension XCTestCase { | |
public func expect(block: (fulfill: (Void) -> Void) -> Void) { | |
let expectation = self.expectation() |
View nuke_01.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = ImageRequest(URLRequest: <#NSURLRequest#>) | |
request.targetSize = CGSize(width: 200, height: 200) // Resize image | |
request.processor = <#ImageProcessing#> // Apply image filters | |
Nuke.taskWithRequest(request) { response in | |
let image = response.image | |
}.resume() |
View GMAutoRetryController.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
static const NSInteger GMAutoRetryControllerInfiniteAttemptCount = INT_MAX; | |
/*! Auto retry with progressive delay. Thread safe. | |
*/ | |
@interface GMAutoRetryController : NSObject | |
@property (nullable, nonatomic, copy) void (^block)(GMAutoRetryController *__nonnull autoRetryController); |
View GMAutoRetryController.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "GMAutoRetryController.h" | |
#import "NSTimer+GMBlocks.h" | |
#import "NSError+Fitmeup.h" | |
#import "GMNetworkReachability.h" | |
#import "GMRepository.h" | |
typedef NS_ENUM(NSInteger, _GMARCState) { | |
_GMARCStateSuspended, // initial state |
View GMAutoRetryControlleExampler.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)_fetchSomethingOrDieWithCompletion:(void (^)(id something))completion { | |
_autoRetryController = [[[GMURLAutoRetryController alloc] initWithBlock:^(GMAutoRetryController * _Nonnull controller) { | |
[/* start request with */ completion:^(id __nullable something, NSError * __nullable error) { | |
if (error) { | |
[controller scheduleAutoRetryWithError:error]; | |
} else { | |
completion(something); | |
} | |
}]; | |
}] resume]; |
OlderNewer