Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for Xcode 9 and Swift 4.1 and iOS 11.3 #778

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
47 changes: 26 additions & 21 deletions SWRevealViewController/SWRevealViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,11 @@ - (CGRect)finalFrameForViewController:(UIViewController *)vc
return _view.bounds;
}

- (void)pauseInteractiveTransition {
return;
}


@end


Expand Down Expand Up @@ -1023,16 +1028,16 @@ - (void)_notifyPanGestureEnded

- (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 ) (void)(*pRevealWidth = _rightViewRevealWidth), *pRevealOverdraw = _rightViewRevealOverdraw;
Copy link

@phoney phoney May 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the normal way to write this code. Just add braces and semicolons.
if ( symetry < 0 ) {*pRevealWidth = _rightViewRevealWidth; *pRevealOverdraw = _rightViewRevealOverdraw; }
else {*pRevealWidth = _rearViewRevealWidth; *pRevealOverdraw = _rearViewRevealOverdraw; }

Those void's are just not normally used like that.

else (void)(*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 ) (void)(*pBounceBack = _bounceBackOnLeftOverdraw), *pStableDrag = _stableDragOnLeftOverdraw;
else (void)(*pBounceBack = _bounceBackOnOverdraw), *pStableDrag = _stableDragOnOverdraw;
}

- (void)_getAdjustedFrontViewPosition:(FrontViewPosition*)frontViewPosition forSymetry:(int)symetry
Expand Down Expand Up @@ -1398,11 +1403,11 @@ - (void)_dispatchTransitionOperation:(SWRevealControllerOperation)operation with
// 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) = ^()
{
// Calling this in the animation block causes the status bar to appear/dissapear in sync with our own animation
[self setNeedsStatusBarAppearanceUpdate];
Expand Down Expand Up @@ -1455,17 +1460,17 @@ - (void)_performTransitionOperation:(SWRevealControllerOperation)operation withV
UIView *view = nil;

if ( operation == SWRevealControllerOperationReplaceRearController )
old = _rearViewController, _rearViewController = new, view = _contentView.rearView;
(void)(old = _rearViewController), (void)(_rearViewController = new), view = _contentView.rearView;

else if ( operation == SWRevealControllerOperationReplaceFrontController )
old = _frontViewController, _frontViewController = new, view = _contentView.frontView;
(void)(old = _frontViewController), (void)(_frontViewController = new), view = _contentView.frontView;

else if ( operation == SWRevealControllerOperationReplaceRightController )
old = _rightViewController, _rightViewController = new, view = _contentView.rightView;
(void)(old = _rightViewController), (void)(_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:)] )
Expand Down Expand Up @@ -1527,10 +1532,10 @@ - (void)_performTransitionOperation:(SWRevealControllerOperation)operation withV

_frontViewPosition = newPosition;

void (^deploymentCompletion)() =
void (^deploymentCompletion)(void) =
[self _deploymentForViewController:_frontViewController inView:_contentView.frontView appear:appear disappear:disappear];

void (^completion)() = ^()
void (^completion)(void) = ^()
{
deploymentCompletion();
if ( positionIsChanging )
Expand Down Expand Up @@ -1561,10 +1566,10 @@ - (void)_performTransitionOperation:(SWRevealControllerOperation)operation withV

_rearViewPosition = newPosition;

void (^deploymentCompletion)() =
void (^deploymentCompletion)(void) =
[self _deploymentForViewController:_rearViewController inView:_contentView.rearView appear:appear disappear:disappear];

void (^completion)() = ^()
void (^completion)(void) = ^()
{
deploymentCompletion();
if ( disappear )
Expand All @@ -1589,10 +1594,10 @@ - (void)_performTransitionOperation:(SWRevealControllerOperation)operation withV

_rightViewPosition = newPosition;

void (^deploymentCompletion)() =
void (^deploymentCompletion)(void) =
[self _deploymentForViewController:_rightViewController inView:_contentView.rightView appear:appear disappear:disappear];

void (^completion)() = ^()
void (^completion)(void) = ^()
{
deploymentCompletion();
if ( disappear )
Expand Down Expand Up @@ -1672,11 +1677,11 @@ - (void)_performTransitionOperation:(SWRevealControllerOperation)operation withV

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)
{
Expand Down