Enable XCode 9 recommended warnings and fix occurrences of them in the code

This commit is contained in:
Cameron Gutman
2018-02-19 14:26:12 -08:00
parent dfd30c0624
commit c913b3f04f
5 changed files with 77 additions and 27 deletions

View File

@@ -996,16 +996,32 @@ const int FrontViewPositionNone = 0xff;
- (void)_getRevealWidth:(CGFloat*)pRevealWidth revealOverDraw:(CGFloat*)pRevealOverdraw forSymetry:(int)symetry
{
if ( symetry < 0 ) *pRevealWidth = _rightViewRevealWidth, *pRevealOverdraw = _rightViewRevealOverdraw;
else *pRevealWidth = _rearViewRevealWidth, *pRevealOverdraw = _rearViewRevealOverdraw;
if ( symetry < 0 )
{
*pRevealWidth = _rightViewRevealWidth;
*pRevealOverdraw = _rightViewRevealOverdraw;
}
else
{
*pRevealWidth = _rearViewRevealWidth;
*pRevealOverdraw = _rearViewRevealOverdraw;
}
if (*pRevealWidth < 0) *pRevealWidth = _contentView.bounds.size.width + *pRevealWidth;
}
- (void)_getBounceBack:(BOOL*)pBounceBack pStableDrag:(BOOL*)pStableDrag forSymetry:(int)symetry
{
if ( symetry < 0 ) *pBounceBack = _bounceBackOnLeftOverdraw, *pStableDrag = _stableDragOnLeftOverdraw;
else *pBounceBack = _bounceBackOnOverdraw, *pStableDrag = _stableDragOnOverdraw;
if ( symetry < 0 )
{
*pBounceBack = _bounceBackOnLeftOverdraw;
*pStableDrag = _stableDragOnLeftOverdraw;
}
else
{
*pBounceBack = _bounceBackOnOverdraw;
*pStableDrag = _stableDragOnOverdraw;
}
}
- (void)_getAdjustedFrontViewPosition:(FrontViewPosition*)frontViewPosition forSymetry:(int)symetry
@@ -1398,11 +1414,11 @@ const int FrontViewPositionNone = 0xff;
// Primitive method for view controller deployment and animated layout to the given position.
- (void)_setFrontViewPosition:(FrontViewPosition)newPosition withDuration:(NSTimeInterval)duration
{
void (^rearDeploymentCompletion)() = [self _rearViewDeploymentForNewFrontViewPosition:newPosition];
void (^rightDeploymentCompletion)() = [self _rightViewDeploymentForNewFrontViewPosition:newPosition];
void (^frontDeploymentCompletion)() = [self _frontViewDeploymentForNewFrontViewPosition:newPosition];
void (^rearDeploymentCompletion)(void) = [self _rearViewDeploymentForNewFrontViewPosition:newPosition];
void (^rightDeploymentCompletion)(void) = [self _rightViewDeploymentForNewFrontViewPosition:newPosition];
void (^frontDeploymentCompletion)(void) = [self _frontViewDeploymentForNewFrontViewPosition:newPosition];
void (^animations)() = ^()
void (^animations)(void) = ^(void)
{
// Calling this in the animation block causes the status bar to appear/dissapear in sync with our own animation
[self setNeedsStatusBarAppearanceUpdate];
@@ -1455,17 +1471,27 @@ const int FrontViewPositionNone = 0xff;
UIView *view = nil;
if ( operation == SWRevealControllerOperationReplaceRearController )
old = _rearViewController, _rearViewController = new, view = _contentView.rearView;
{
old = _rearViewController;
_rearViewController = new;
view = _contentView.rearView;
}
else if ( operation == SWRevealControllerOperationReplaceFrontController )
old = _frontViewController, _frontViewController = new, view = _contentView.frontView;
{
old = _frontViewController;
_frontViewController = new;
view = _contentView.frontView;
}
else if ( operation == SWRevealControllerOperationReplaceRightController )
old = _rightViewController, _rightViewController = new, view = _contentView.rightView;
{
old = _rightViewController;
_rightViewController = new;
view = _contentView.rightView;
}
void (^completion)() = [self _transitionFromViewController:old toViewController:new inView:view];
void (^completion)(void) = [self _transitionFromViewController:old toViewController:new inView:view];
void (^animationCompletion)() = ^
void (^animationCompletion)(void) = ^
{
completion();
if ( [_delegate respondsToSelector:@selector(revealController:didAddViewController:forOperation:animated:)] )
@@ -1527,10 +1553,10 @@ const int FrontViewPositionNone = 0xff;
_frontViewPosition = newPosition;
void (^deploymentCompletion)() =
void (^deploymentCompletion)(void) =
[self _deploymentForViewController:_frontViewController inView:_contentView.frontView appear:appear disappear:disappear];
void (^completion)() = ^()
void (^completion)(void) = ^(void)
{
deploymentCompletion();
if ( positionIsChanging )
@@ -1652,11 +1678,11 @@ const int FrontViewPositionNone = 0xff;
if ( toController ) [self addChildViewController:toController];
void (^deployCompletion)() = [self _deployForViewController:toController inView:view];
void (^deployCompletion)(void) = [self _deployForViewController:toController inView:view];
[fromController willMoveToParentViewController:nil];
void (^undeployCompletion)() = [self _undeployForViewController:fromController];
void (^undeployCompletion)(void) = [self _undeployForViewController:fromController];
void (^completionBlock)(void) = ^(void)
{