0003-Upgrade-ObjC-syntax.patch 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. From 282d6daa3c4e2132f892da3b3a82c5171ae411c4 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
  3. Date: Sun, 28 Apr 2013 17:35:08 +0200
  4. Subject: [PATCH 3/3] Upgrade ObjC syntax
  5. ---
  6. Classes/AQGridView.m | 16 ++++++++--------
  7. Classes/AQGridViewCell.m | 18 +++++++++---------
  8. Classes/AQGridViewUpdateInfo.m | 24 ++++++++++++------------
  9. 3 files changed, 29 insertions(+), 29 deletions(-)
  10. diff --git a/Classes/AQGridView.m b/Classes/AQGridView.m
  11. index babe070..38d2525 100755
  12. --- a/Classes/AQGridView.m
  13. +++ b/Classes/AQGridView.m
  14. @@ -574,7 +574,7 @@ NSString * const AQGridViewSelectionDidChangeNotification = @"AQGridViewSelectio
  15. - (AQGridViewCell *) dequeueReusableCellWithIdentifier: (NSString *) reuseIdentifier
  16. {
  17. - NSMutableSet * cells = [_reusableGridCells objectForKey: reuseIdentifier];
  18. + NSMutableSet * cells = _reusableGridCells[reuseIdentifier];
  19. AQGridViewCell * cell = [cells anyObject];
  20. if ( cell == nil )
  21. return ( nil );
  22. @@ -589,11 +589,11 @@ NSString * const AQGridViewSelectionDidChangeNotification = @"AQGridViewSelectio
  23. {
  24. for ( AQGridViewCell * cell in reusableCells )
  25. {
  26. - NSMutableSet * reuseSet = [_reusableGridCells objectForKey: cell.reuseIdentifier];
  27. + NSMutableSet * reuseSet = _reusableGridCells[cell.reuseIdentifier];
  28. if ( reuseSet == nil )
  29. {
  30. reuseSet = [[NSMutableSet alloc] initWithCapacity: 32];
  31. - [_reusableGridCells setObject: reuseSet forKey: cell.reuseIdentifier];
  32. + _reusableGridCells[cell.reuseIdentifier] = reuseSet;
  33. }
  34. else if ( [reuseSet member: cell] == cell )
  35. {
  36. @@ -724,7 +724,7 @@ NSString * const AQGridViewSelectionDidChangeNotification = @"AQGridViewSelectio
  37. {
  38. // simple case -- there's a cell already, we can just ask for its frame
  39. if ( NSLocationInRange(index, _visibleIndices) )
  40. - return ( [[_visibleCells objectAtIndex: [self visibleCellListIndexForItemIndex: index]] frame] );
  41. + return ( [_visibleCells[[self visibleCellListIndexForItemIndex: index]] frame] );
  42. // complex case-- compute the frame manually
  43. return ( [self fixCellFrame: CGRectZero forGridRect: [_gridData cellRectAtIndex: index]] );
  44. @@ -738,7 +738,7 @@ NSString * const AQGridViewSelectionDidChangeNotification = @"AQGridViewSelectio
  45. // we don't clip to visible range-- when animating edits the visible cell list can contain extra items
  46. NSUInteger visibleCellListIndex = [self visibleCellListIndexForItemIndex: index];
  47. if ( visibleCellListIndex < [_visibleCells count] )
  48. - return ( [_visibleCells objectAtIndex: visibleCellListIndex] );
  49. + return ( _visibleCells[visibleCellListIndex] );
  50. return ( nil );
  51. }
  52. @@ -1340,7 +1340,7 @@ NSString * const AQGridViewSelectionDidChangeNotification = @"AQGridViewSelectio
  53. // NB: In UITableView:
  54. // if ( [self usesGestureRecognizers] && [self isDragging] ) skip next line
  55. [self performSelector: @selector(_gridViewDeferredTouchesBegan:)
  56. - withObject: [NSNumber numberWithUnsignedInteger: index]
  57. + withObject: @(index)
  58. afterDelay: 0.0];
  59. }
  60. }
  61. @@ -1485,7 +1485,7 @@ NSArray * __sortDescriptors;
  62. {
  63. static dispatch_once_t onceToken;
  64. dispatch_once(&onceToken, ^{
  65. - __sortDescriptors = [[NSArray alloc] initWithObjects: [[NSSortDescriptor alloc] initWithKey: @"displayIndex" ascending: YES], nil];
  66. + __sortDescriptors = @[[[NSSortDescriptor alloc] initWithKey: @"displayIndex" ascending: YES]];
  67. });
  68. [_visibleCells sortUsingDescriptors: __sortDescriptors];
  69. @@ -1654,7 +1654,7 @@ NSArray * __sortDescriptors;
  70. NSUInteger i, count = [_visibleCells count];
  71. for ( i = 0; i < count; i++ )
  72. {
  73. - AQGridViewCell * cell = [_visibleCells objectAtIndex: i];
  74. + AQGridViewCell * cell = _visibleCells[i];
  75. if ( [newVisibleIndices containsIndex: cell.displayIndex] == NO &&
  76. [animatingDestinationIndices containsIndex: cell.displayIndex] == NO )
  77. {
  78. diff --git a/Classes/AQGridViewCell.m b/Classes/AQGridViewCell.m
  79. index d5307df..1eb72ba 100644
  80. --- a/Classes/AQGridViewCell.m
  81. +++ b/Classes/AQGridViewCell.m
  82. @@ -127,7 +127,7 @@
  83. _contentView.autoresizesSubviews = YES;
  84. self.autoresizesSubviews = YES;
  85. _contentView.backgroundColor = [UIColor whiteColor];
  86. - [_contentView.layer setValue: [NSNumber numberWithBool: YES] forKey: @"KoboHackInterestingLayer"];
  87. + [_contentView.layer setValue: @YES forKey: @"KoboHackInterestingLayer"];
  88. [self addSubview: _contentView];
  89. }
  90. return ( _contentView );
  91. @@ -206,7 +206,7 @@
  92. id value = view.backgroundColor;
  93. if ( value == nil )
  94. value = [NSNull null];
  95. - [info setObject: value forKey: @"backgroundColor"];
  96. + info[@"backgroundColor"] = value;
  97. view.opaque = NO;
  98. view.backgroundColor = color;
  99. @@ -223,7 +223,7 @@
  100. NSMutableDictionary * info = (NSMutableDictionary *) objc_unretainedObject(CFDictionaryGetValue( _selectionColorInfo, objc_unretainedPointer(view) ));
  101. if ( info != nil )
  102. {
  103. - id value = [info objectForKey: @"backgroundColor"];
  104. + id value = info[@"backgroundColor"];
  105. if ( value == nil )
  106. continue;
  107. @@ -254,15 +254,15 @@
  108. // don't overwrite any prior cache of a view's original highlighted state.
  109. // this is because 'highlighted' will be set, then 'selected', which can perform 'highlight' again before the animation completes
  110. - if ( [info objectForKey: @"highlighted"] == nil )
  111. + if ( info[@"highlighted"] == nil )
  112. {
  113. id value = [view valueForKey: @"highlighted"];
  114. if ( value == nil )
  115. - value = [NSNumber numberWithBool: NO];
  116. - [info setObject: value forKey: @"highlighted"];
  117. + value = @NO;
  118. + info[@"highlighted"] = value;
  119. }
  120. - [view setValue: [NSNumber numberWithBool: YES]
  121. + [view setValue: @YES
  122. forKey: @"highlighted"];
  123. }
  124. @@ -278,7 +278,7 @@
  125. NSMutableDictionary * info = (NSMutableDictionary *) objc_unretainedObject(CFDictionaryGetValue( _selectionColorInfo, objc_unretainedPointer(view) ));
  126. if ( info != nil )
  127. {
  128. - id value = [info objectForKey: @"highlighted"];
  129. + id value = info[@"highlighted"];
  130. [view setValue: value forKey: @"highlighted"];
  131. }
  132. }
  133. @@ -388,7 +388,7 @@
  134. interval: 0.1
  135. target: self
  136. selector: @selector(flipHighlightTimerFired:)
  137. - userInfo: [NSNumber numberWithBool: highlightOn]
  138. + userInfo: @(highlightOn)
  139. repeats: NO];
  140. [[NSRunLoop currentRunLoop] addTimer: _fadeTimer forMode: NSDefaultRunLoopMode];
  141. }
  142. diff --git a/Classes/AQGridViewUpdateInfo.m b/Classes/AQGridViewUpdateInfo.m
  143. index 9bf5148..f016dec 100644
  144. --- a/Classes/AQGridViewUpdateInfo.m
  145. +++ b/Classes/AQGridViewUpdateInfo.m
  146. @@ -562,8 +562,8 @@
  147. CGSize cellSize = cell.frame.size;
  148. - [itemsToSetBeforeAnimation setObject: [NSNumber numberWithFloat: 0.0] forKey: @"alpha"];
  149. - [itemsToAnimate setObject: [NSNumber numberWithFloat: 1.0] forKey: @"alpha"];
  150. + itemsToSetBeforeAnimation[@"alpha"] = @0.0f;
  151. + itemsToAnimate[@"alpha"] = @1.0f;
  152. switch ( animation )
  153. {
  154. @@ -576,36 +576,36 @@
  155. case AQGridViewItemAnimationRight:
  156. {
  157. CGPoint center = cell.center;
  158. - [itemsToAnimate setObject: [NSValue valueWithCGPoint: center] forKey: @"center"];
  159. + itemsToAnimate[@"center"] = [NSValue valueWithCGPoint: center];
  160. center.x += cellSize.width;
  161. - [itemsToSetBeforeAnimation setObject: [NSValue valueWithCGPoint: center] forKey: @"center"];
  162. + itemsToSetBeforeAnimation[@"center"] = [NSValue valueWithCGPoint: center];
  163. break;
  164. }
  165. case AQGridViewItemAnimationLeft:
  166. {
  167. CGPoint center = cell.center;
  168. - [itemsToAnimate setObject: [NSValue valueWithCGPoint: center] forKey: @"center"];
  169. + itemsToAnimate[@"center"] = [NSValue valueWithCGPoint: center];
  170. center.x -= cellSize.width;
  171. - [itemsToSetBeforeAnimation setObject: [NSValue valueWithCGPoint: center] forKey: @"center"];
  172. + itemsToSetBeforeAnimation[@"center"] = [NSValue valueWithCGPoint: center];
  173. break;
  174. }
  175. case AQGridViewItemAnimationTop:
  176. {
  177. CGPoint center = cell.center;
  178. - [itemsToAnimate setObject: [NSValue valueWithCGPoint: center] forKey: @"center"];
  179. + itemsToAnimate[@"center"] = [NSValue valueWithCGPoint: center];
  180. center.y -= cellSize.height;
  181. - [itemsToSetBeforeAnimation setObject: [NSValue valueWithCGPoint: center] forKey: @"center"];
  182. + itemsToSetBeforeAnimation[@"center"] = [NSValue valueWithCGPoint: center];
  183. break;
  184. }
  185. case AQGridViewItemAnimationBottom:
  186. {
  187. CGPoint center = cell.center;
  188. - [itemsToAnimate setObject: [NSValue valueWithCGPoint: center] forKey: @"center"];
  189. + itemsToAnimate[@"center"] = [NSValue valueWithCGPoint: center];
  190. center.y += cellSize.height;
  191. - [itemsToSetBeforeAnimation setObject: [NSValue valueWithCGPoint: center] forKey: @"center"];
  192. + itemsToSetBeforeAnimation[@"center"] = [NSValue valueWithCGPoint: center];
  193. break;
  194. }
  195. @@ -616,13 +616,13 @@
  196. [UIView setAnimationsEnabled: NO];
  197. for ( NSString * keyPath in itemsToSetBeforeAnimation )
  198. {
  199. - [cell setValue: [itemsToSetBeforeAnimation objectForKey: keyPath] forKey: keyPath];
  200. + [cell setValue: itemsToSetBeforeAnimation[keyPath] forKey: keyPath];
  201. }
  202. [UIView setAnimationsEnabled: YES];
  203. for ( NSString * keyPath in itemsToAnimate )
  204. {
  205. - [cell setValue: [itemsToAnimate objectForKey: keyPath] forKey: keyPath];
  206. + [cell setValue: itemsToAnimate[keyPath] forKey: keyPath];
  207. }
  208. }
  209. --
  210. 1.7.12.4 (Apple Git-37)