Supports status bar preffered style for all panels
Transitions supported
Flip From Left
Flip From Right
Flip From Top
Flip From Bottom
Curl Up
Curl Down
Cross Dissolve
Move Up
Move Down
Move Left
Move Right
Split Horizontally
Split Vertically
Dump Fall
Box Fade
Panel configurations
// Panels widthvarleftPanelWidth:CGFloat=280// It will override the gap percentage valuevarrightPanelWidth:CGFloat=280varleftPanelGapPercentage:CGFloat= 0.8
varrightPanelGapPercentage:CGFloat= 0.8
// resizes all subviews as wellvarresizeLeftPanel:Bool= false
varresizeRightPanel:Bool= false
// Adds push animation on side panelsvarpusheSidePanels:Bool= false
// Bounce effects on panel animationsvarbounceOnLeftPanelOpen:Bool= true
varbounceOnRightPanelOpen:Bool= true
varbounceOnCenterPanelOpen:Bool= true
varbounceOnLeftPanelClose:Bool= false
varbounceOnRightPanelClose:Bool= false
varbounceOnCenterPanelChange:Bool= true
varbouncePercentage:CGFloat= 0.075
varbounceDuration:CGFloat= 0.1
// Panning GesturevarcanRecognizePanGesture:Bool= true
varpanFromEdge:Bool= false
varminEdgeForLeftPanel:CGFloat= 70.0
varminEdgeForRightPanel:CGFloat= 70.0
varcanLeftSwipe:Bool= true
varcanRightSwipe:Bool= true
// restricts panning gesture to work for top VC of Navigation/TabBar ControllervarrestrictPanningToTopVC:Bool= true
// Handles the interface auto rotation of visible panelvarhandleAutoRotation:Bool= true
// Applies corner radius to panelsvarcornerRadius:CGFloat= 0.0
// Remove panels from super view when possiblevarunloadRightPanel:Bool= false
varunloadLeftPanel:Bool= false
// Max animation duration for animations of side panelsvarmaxAnimDuration:CGFloat= 0.20
// percentage of screen's width to the centerPanel.view must move for panGesture to succeedvarminMovePercentage:CGFloat= 0.15
// Only Center Panel Change animationvarchangeCenterPanelAnimated:Bool= true
varcenterPanelTransitionType:FAPanelTransitionType=.crossDissolve
varcenterPanelTransitionDuration:TimeInterval= 0.60
Installation
Cocoapods
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
To integrate FAPanel into your Xcode project using CocoaPods, specify it in your Podfile:
Set the root window as FAPanel controller as shown in below image,
Step 2
Add the following code in AppDelegate.swift file,
// Load the Controllers letmainStoryboard:UIStoryboard=UIStoryboard(name:"Main", bundle:nil)letleftMenuVC:LeftMenuVC= mainStoryboard.instantiateViewController(withIdentifier:"LeftMenuVC")as!LeftMenuVCletrightMenuVC:RightMenuVC= mainStoryboard.instantiateViewController(withIdentifier:"RightMenuVC")as!RightMenuVCletcenterVC:CenterVC= mainStoryboard.instantiateViewController(withIdentifier:"CenterVC1")as!CenterVCletcenterNavVC=UINavigationController(rootViewController: centerVC)// Set the Panel controllers with just two lines of codeletrootController:FAPanelController= window?.rootViewController as!FAPanelController
rootController.center(centerNavVC).left(leftMenuVC).right(rightMenuVC)
All done! Run the code and see the magic.
Step 2 (Continue - Panel Controllers)
Don't want to set RightMenuVC then just remove the right panel code i.e,
// This is the code to set all panels
rootController.center(centerNavVC).left(leftMenuVC).right(rightMenuVC)// Updated code which have only left and center panels
rootController.center(centerNavVC).left(leftMenuVC)// Similarly, if left panel is not needed the remove the left panel code.
rootController.center(centerNavVC).right(rightMenuVC)// In case you only want the center panel, then update code to
rootController.center(centerNavVC)
Step 2 (Continue - Panel Configurations)
Configre the Panels before setting the panels
rootController.configs.rightPanelWidth =80
rootController.configs.bounceOnRightPanelOpen = false
// Should Pan from edge? Add these lines of code,
rootController.configs.panFromEdge = false
rootController.configs.minEdgeForLeftPanel =70
rootController.configs.minEdgeForRightPanel =70
rootController.center(centerNavVC).left(leftMenuVC).right(rightMenuVC)// For more configurations and their details, Please have a look into ``` FAPanelConfigurations.swift ``` file
Change Left, Right or Center Panel from any view controller
// Change Center panelletcenterVC:UIViewController= mainStoryboard.instantiateViewController(withIdentifier:"CenterVC2")letcenterNavVC=UINavigationController(rootViewController: centerVC)
panel!.center(centerNavVC)// Change Left panelletleftVC:UIViewController= mainStoryboard.instantiateViewController(withIdentifier:"LeftVC")
panel!.left(leftVC)// Remove Left panel
panel!.left(nil)
Preview, when changing center panel from left/right panels
Change Center Panel (With custom transitions and durations)
Change Left, Right or Center Panel from any view controller
// Specify the transition type
panel!.configs.centerPanelTransitionType =.transitionOption // Transitions supported are mentioned in FAPanelTransitionType// Specify the transition duration
panel!.configs.centerPanelTransitionDuration = 0.60
// Update the center panel
panel!.center(centerNavVC)
Transitions Preview
flipFromLeft
flipFromRight
flipFromTop
flipFromBottom
curlUp
curlDown
crossDissolve
moveRight
moveLeft
moveUp
moveDown
splitVertically
splitHorizontally
dumpFall
boxFade
Supports interface rotation
License
FAPanels is licensed under the Apache License 2.0.