mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Merge pull request #1528 from ejensen/instancetype
[Refactoring] Replace id with instancetype in initializers
This commit is contained in:
@@ -80,7 +80,7 @@ static BOOL _enableHitTestDebug = NO;
|
||||
|
||||
#pragma mark - Lifecycle
|
||||
|
||||
- (id)init
|
||||
- (instancetype)init
|
||||
{
|
||||
if (!(self = [super init]))
|
||||
return nil;
|
||||
|
||||
@@ -256,7 +256,7 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
||||
_environmentState = ASEnvironmentStateMakeDefault();
|
||||
}
|
||||
|
||||
- (id)init
|
||||
- (instancetype)init
|
||||
{
|
||||
if (!(self = [super init]))
|
||||
return nil;
|
||||
@@ -266,7 +266,7 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithViewClass:(Class)viewClass
|
||||
- (instancetype)initWithViewClass:(Class)viewClass
|
||||
{
|
||||
if (!(self = [super init]))
|
||||
return nil;
|
||||
@@ -280,7 +280,7 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithLayerClass:(Class)layerClass
|
||||
- (instancetype)initWithLayerClass:(Class)layerClass
|
||||
{
|
||||
if (!(self = [super init]))
|
||||
return nil;
|
||||
@@ -295,12 +295,12 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock
|
||||
- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock
|
||||
{
|
||||
return [self initWithViewBlock:viewBlock didLoadBlock:nil];
|
||||
}
|
||||
|
||||
- (id)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(ASDisplayNodeDidLoadBlock)didLoadBlock
|
||||
- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(ASDisplayNodeDidLoadBlock)didLoadBlock
|
||||
{
|
||||
if (!(self = [super init]))
|
||||
return nil;
|
||||
@@ -315,12 +315,12 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithLayerBlock:(ASDisplayNodeLayerBlock)layerBlock
|
||||
- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)layerBlock
|
||||
{
|
||||
return [self initWithLayerBlock:layerBlock didLoadBlock:nil];
|
||||
}
|
||||
|
||||
- (id)initWithLayerBlock:(ASDisplayNodeLayerBlock)layerBlock didLoadBlock:(ASDisplayNodeDidLoadBlock)didLoadBlock
|
||||
- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)layerBlock didLoadBlock:(ASDisplayNodeDidLoadBlock)didLoadBlock
|
||||
{
|
||||
if (!(self = [super init]))
|
||||
return nil;
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
// TODO: eliminate explicit parameters with a set of keys copied from the node
|
||||
@implementation _ASImageNodeDrawParameters
|
||||
|
||||
- (id)initWithImage:(UIImage *)image
|
||||
- (instancetype)initWithImage:(UIImage *)image
|
||||
bounds:(CGRect)bounds
|
||||
opaque:(BOOL)opaque
|
||||
contentsScale:(CGFloat)contentsScale
|
||||
@@ -86,7 +86,7 @@
|
||||
@synthesize image = _image;
|
||||
@synthesize imageModificationBlock = _imageModificationBlock;
|
||||
|
||||
- (id)init
|
||||
- (instancetype)init
|
||||
{
|
||||
if (!(self = [super init]))
|
||||
return nil;
|
||||
|
||||
@@ -20,14 +20,14 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@param rects Array containing CGRects wrapped in NSValue.
|
||||
@param targetLayer The layer that the rects are relative to. The rects will be translated to the receiver's coordinate space when rendering.
|
||||
*/
|
||||
- (id)initWithRects:(NSArray<NSValue *> *)rects targetLayer:(nullable CALayer *)targetLayer;
|
||||
- (instancetype)initWithRects:(NSArray<NSValue *> *)rects targetLayer:(nullable CALayer *)targetLayer;
|
||||
|
||||
/**
|
||||
@summary Initializes with CGRects for the highlighting, in the receiver's coordinate space.
|
||||
|
||||
@param rects Array containing CGRects wrapped in NSValue.
|
||||
*/
|
||||
- (id)initWithRects:(NSArray<NSValue *> *)rects;
|
||||
- (instancetype)initWithRects:(NSArray<NSValue *> *)rects;
|
||||
|
||||
@property (nullable, atomic, strong) __attribute__((NSObject)) CGColorRef highlightColor;
|
||||
@property (atomic, weak) CALayer *targetLayer;
|
||||
|
||||
@@ -49,12 +49,12 @@ static const UIEdgeInsets padding = {2, 4, 1.5, 4};
|
||||
return (id<CAAction>)[NSNull null];
|
||||
}
|
||||
|
||||
- (id)initWithRects:(NSArray *)rects
|
||||
- (instancetype)initWithRects:(NSArray *)rects
|
||||
{
|
||||
return [self initWithRects:rects targetLayer:nil];
|
||||
}
|
||||
|
||||
- (id)initWithRects:(NSArray *)rects targetLayer:(id)targetLayer
|
||||
- (instancetype)initWithRects:(NSArray *)rects targetLayer:(id)targetLayer
|
||||
{
|
||||
if (self = [super init]) {
|
||||
_rects = [rects copy];
|
||||
|
||||
@@ -54,7 +54,7 @@ extern NSInteger const ASDefaultTransactionPriority;
|
||||
@param callbackQueue The dispatch queue that the completion blocks will be called on.
|
||||
@param completionBlock A block that is called when the transaction is completed. May be NULL.
|
||||
*/
|
||||
- (id)initWithCallbackQueue:(dispatch_queue_t)callbackQueue
|
||||
- (instancetype)initWithCallbackQueue:(dispatch_queue_t)callbackQueue
|
||||
completionBlock:(asyncdisplaykit_async_transaction_completion_block_t)completionBlock;
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
NSInteger const ASDefaultTransactionPriority = 0;
|
||||
|
||||
@interface ASDisplayNodeAsyncTransactionOperation : NSObject
|
||||
- (id)initWithOperationCompletionBlock:(asyncdisplaykit_async_transaction_operation_completion_block_t)operationCompletionBlock;
|
||||
- (instancetype)initWithOperationCompletionBlock:(asyncdisplaykit_async_transaction_operation_completion_block_t)operationCompletionBlock;
|
||||
@property (nonatomic, copy) asyncdisplaykit_async_transaction_operation_completion_block_t operationCompletionBlock;
|
||||
@property (atomic, strong) id<NSObject> value; // set on bg queue by the operation block
|
||||
@end
|
||||
|
||||
@implementation ASDisplayNodeAsyncTransactionOperation
|
||||
|
||||
- (id)initWithOperationCompletionBlock:(asyncdisplaykit_async_transaction_operation_completion_block_t)operationCompletionBlock
|
||||
- (instancetype)initWithOperationCompletionBlock:(asyncdisplaykit_async_transaction_operation_completion_block_t)operationCompletionBlock
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
_operationCompletionBlock = [operationCompletionBlock copy];
|
||||
@@ -315,7 +315,7 @@ ASAsyncTransactionQueue & ASAsyncTransactionQueue::instance()
|
||||
#pragma mark -
|
||||
#pragma mark Lifecycle
|
||||
|
||||
- (id)initWithCallbackQueue:(dispatch_queue_t)callbackQueue
|
||||
- (instancetype)initWithCallbackQueue:(dispatch_queue_t)callbackQueue
|
||||
completionBlock:(void(^)(_ASAsyncTransaction *, BOOL))completionBlock
|
||||
{
|
||||
if ((self = [self init])) {
|
||||
|
||||
@@ -62,7 +62,7 @@ static void _transactionGroupRunLoopObserverCallback(CFRunLoopObserverRef observ
|
||||
CFRelease(observer);
|
||||
}
|
||||
|
||||
- (id)init
|
||||
- (instancetype)init
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
_containerLayers = [NSHashTable hashTableWithOptions:NSPointerFunctionsObjectPointerPersonality];
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#pragma mark -
|
||||
#pragma mark Lifecycle
|
||||
|
||||
- (id)init
|
||||
- (instancetype)init
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
_displaySentinel = [[ASSentinel alloc] init];
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
}
|
||||
|
||||
#pragma mark - NSObject Overrides
|
||||
- (id)init
|
||||
- (instancetype)init
|
||||
{
|
||||
return [self initWithFrame:CGRectZero];
|
||||
}
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
#pragma mark - UIView Overrides
|
||||
|
||||
- (id)initWithFrame:(CGRect)frame
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if (!(self = [super initWithFrame:frame]))
|
||||
return nil;
|
||||
|
||||
@@ -193,10 +193,10 @@ FOUNDATION_EXPORT NSString * const ASRenderingEngineDidDisplayNodesScheduledBefo
|
||||
- (void)displayImmediately;
|
||||
|
||||
// Alternative initialiser for backing with a custom view class. Supports asynchronous display with _ASDisplayView subclasses.
|
||||
- (id)initWithViewClass:(Class)viewClass;
|
||||
- (instancetype)initWithViewClass:(Class)viewClass;
|
||||
|
||||
// Alternative initialiser for backing with a custom layer class. Supports asynchronous display with _ASDisplayLayer subclasses.
|
||||
- (id)initWithLayerClass:(Class)layerClass;
|
||||
- (instancetype)initWithLayerClass:(Class)layerClass;
|
||||
|
||||
@property (nonatomic, assign) CGFloat contentsScaleForDisplay;
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ ASDISPLAYNODE_INLINE void ASPendingStateApplyMetricsToLayer(_ASPendingState *sta
|
||||
static CGColorRef blackColorRef = NULL;
|
||||
static UIColor *defaultTintColor = nil;
|
||||
|
||||
- (id)init
|
||||
- (instancetype)init
|
||||
{
|
||||
if (!(self = [super init]))
|
||||
return nil;
|
||||
|
||||
Reference in New Issue
Block a user