Home

Awesome

Alt text

<p align="center"> <a href="http://i.imgur.com/ZN13eaf.gif"> <img src="http://i.imgur.com/ZN13eaf.gif" height="450"> </a> </p>

Swift version Support Dependecy Manager Version Carthage Compatible License Platform CocoaPods CocoaPods

Famous Apps Using FAPanels


New Features Added


Change Color Of Center Panel While Panning


open var colorForTapView: UIColor = UIColor.black.withAlphaComponent(0.35)
open var shouldAnimateWithPan: Bool = true

Issues Resolved ( > 0.5.0 only)


Issues Resolved ( > 0.4.0 only)


New Features Added ( > 0.3.5 only)


New Features Added ( > 0.3.1 only)


Usage


//  Create FAPanelController object with out any NSCoder, Storyboards and Nib files

let rootController = FAPanelController()

//  Configure the panels as you want and assign this panel controller to root controller of window.

window?.rootViewController = rootController


//  You can also set window's root controller to any FAPanelController object with different FAPanelConfigurations at any time.

New Features Added ( > 0.3.0 only)


Right Panel Position

backfront

Usage


//  Set the Right Panel position

let rootController: FAPanelController = window?.rootViewController as! FAPanelController

rootController.rightPanelPosition = .front
rootController.rightPanelPosition = .back


New Features Added ( > 0.2.1 only)


Left Panel Position

backfront

Usage


//  Set the Left Panel position

let rootController: FAPanelController = window?.rootViewController as! FAPanelController

rootController.leftPanelPosition = .front
rootController.leftPanelPosition = .back


Features


Transitions supported


Panel configurations



// Panels width

var leftPanelWidth : CGFloat = 280  //  It will override the gap percentage value
var rightPanelWidth: CGFloat = 280

var leftPanelGapPercentage : CGFloat = 0.8
var rightPanelGapPercentage: CGFloat = 0.8


// resizes all subviews as well

var resizeLeftPanel : Bool = false
var resizeRightPanel: Bool = false


// Adds push animation on side panels

var pusheSidePanels: Bool = false


// Bounce effects on panel animations

var bounceOnLeftPanelOpen  : Bool = true
var bounceOnRightPanelOpen : Bool = true
var bounceOnCenterPanelOpen: Bool = true


var bounceOnLeftPanelClose   : Bool = false
var bounceOnRightPanelClose  : Bool = false
var bounceOnCenterPanelChange: Bool = true


var bouncePercentage : CGFloat = 0.075
var bounceDuration   : CGFloat = 0.1


//  Panning Gesture

var canRecognizePanGesture: Bool = true

var panFromEdge          : Bool = false
var minEdgeForLeftPanel  : CGFloat = 70.0
var minEdgeForRightPanel : CGFloat = 70.0

var canLeftSwipe : Bool = true
var canRightSwipe: Bool = true


// restricts panning gesture to work for top VC of Navigation/TabBar Controller

var restrictPanningToTopVC: Bool = true


// Handles the interface auto rotation of visible panel

var handleAutoRotation: Bool = true


// Applies corner radius to panels

var cornerRadius: CGFloat = 0.0


// Shadow configurations

open var shadowColor   : CGColor = UIColor.black.cgColor
open var shadowOffset  : CGSize  = CGSize(width: 10.0, height: 0.0)
open var shadowOppacity: Float = 0.5


// Remove panels from super view when possible

var unloadRightPanel: Bool = false
var unloadLeftPanel : Bool = false


// Max animation duration for animations of side panels

var maxAnimDuration  : CGFloat = 0.20


// percentage of screen's width to the centerPanel.view must move for panGesture to succeed

var minMovePercentage: CGFloat = 0.15


// Only Center Panel Change animation

var changeCenterPanelAnimated : Bool = true
var centerPanelTransitionType : FAPanelTransitionType = .crossDissolve
var centerPanelTransitionDuration: 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:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

target '<Your Target Name>' do
pod 'FAPanels'
end

Then, run the following command:

$ pod install

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate FAPanels into your Xcode project using Carthage, specify it in your Cartfile:

github "fahidattique55/FAPanels" >= 0.2.0

Run carthage update to build the framework and drag the built FAPanels.framework into your Xcode project.

Usage

Step 1

Alt text

Step 2


//  Load the Controllers 

let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)

let leftMenuVC: LeftMenuVC = mainStoryboard.instantiateViewController(withIdentifier: "LeftMenuVC") as! LeftMenuVC

let rightMenuVC: RightMenuVC = mainStoryboard.instantiateViewController(withIdentifier: "RightMenuVC") as! RightMenuVC

let centerVC: CenterVC = mainStoryboard.instantiateViewController(withIdentifier: "CenterVC1") as! CenterVC
let centerNavVC = UINavigationController(rootViewController: centerVC)




//  Set the Panel controllers with just two lines of code

let rootController: FAPanelController = window?.rootViewController as! FAPanelController
rootController.center(centerNavVC).left(leftMenuVC).right(rightMenuVC)

Step 2 (Continue - Panel Controllers)


//  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)



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 

Access Panel


panel?.configs = FAPanelConfigurations()


Open/Close Panels


panel?.openLeft(animated: true)
panel?.openRight(animated: true)


<p align="center"> <a href="http://i.imgur.com/1IYEdMn.gif"> <img src="http://i.imgur.com/1IYEdMn.gif" height="450"> </a> </p>

Change/Remove Panels


//  Change Center panel

let centerVC: UIViewController = mainStoryboard.instantiateViewController(withIdentifier: "CenterVC2")
let centerNavVC = UINavigationController(rootViewController: centerVC)

panel!.center(centerNavVC)



//  Change Left panel

let leftVC: UIViewController = mainStoryboard.instantiateViewController(withIdentifier: "LeftVC")
panel!.left(leftVC)


//  Remove Left panel

panel!.left(nil)


<p align="center"> <a href="http://i.imgur.com/C7S8Q7h.gif"> <img src="http://i.imgur.com/C7S8Q7h.gif" height="450"> </a> </p>

Change Center Panel (With custom transitions and durations)


//  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)


flipFromLeftflipFromRight
flipFromTopflipFromBottom
curlUpcurlDown
crossDissolvemoveRight
moveLeftmoveUp
moveDownsplitVertically
splitHorizontallydumpFall
boxFade

Supports interface rotation

<p align="center"> <a href="http://i.imgur.com/4dpN8d7.gif"> <img src="http://i.imgur.com/4dpN8d7.gif" height="450"> </a> </p>

License

FAPanels is licensed under the Apache License 2.0.

For more details visit http://www.apache.org/licenses/LICENSE-2.0

Author

Fahid Attique - (https://github.com/fahidattique55)