Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
03e724c4
Commit
03e724c4
authored
Oct 17, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated interface
parent
d7e2e62f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
71 deletions
+70
-71
Source/SideNavigationViewController.swift
+70
-71
No files found.
Source/SideNavigationViewController.swift
View file @
03e724c4
...
...
@@ -41,6 +41,35 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
//
private
var
originalPosition
:
CGPoint
!
//
// :name: leftPanGesture
//
internal
var
leftPanGesture
:
UIPanGestureRecognizer
?
//
// :name: leftTapGesture
//
internal
var
leftTapGesture
:
UITapGestureRecognizer
?
//
// :name: isViewBasedAppearance
//
internal
var
isViewBasedAppearance
:
Bool
{
return
0
==
NSBundle
.
mainBundle
()
.
objectForInfoDictionaryKey
(
"UIViewControllerBasedStatusBarAppearance"
)
as?
Int
}
//
// :name: isUserInteractionEnabled
//
internal
var
isUserInteractionEnabled
:
Bool
{
get
{
return
mainViewController
!.
view
.
userInteractionEnabled
}
set
(
value
)
{
mainViewController
!.
view
.
userInteractionEnabled
=
value
}
}
/**
:name: horizontalThreshold
*/
...
...
@@ -51,9 +80,9 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
*/
public
lazy
var
animationDuration
:
CGFloat
=
0.25
/
/
//
:name: enabled
/
/
/
**
:name: enabled
*
/
public
lazy
var
enabled
:
Bool
=
true
/**
...
...
@@ -85,32 +114,10 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
}
/**
:name: isViewBasedAppearance
*/
public
var
isViewBasedAppearance
:
Bool
{
return
0
==
NSBundle
.
mainBundle
()
.
objectForInfoDictionaryKey
(
"UIViewControllerBasedStatusBarAppearance"
)
as?
Int
}
/**
:name: isLeftContainerOpened
*/
public
var
isLeftContainerOpened
:
Bool
{
if
let
v
=
leftView
{
return
v
.
x
!=
-
leftViewControllerWidth
}
return
false
}
/**
:name: isUserInteractionEnabled
*/
public
private(set)
var
isUserInteractionEnabled
:
Bool
{
get
{
return
mainViewController
!.
view
.
userInteractionEnabled
}
set
(
value
)
{
mainViewController
!.
view
.
userInteractionEnabled
=
value
}
return
leftView
?
.
x
!=
-
leftViewControllerWidth
}
/**
...
...
@@ -129,24 +136,16 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
public
var
leftViewController
:
UIViewController
?
/**
:name: leftPanGesture
*/
public
var
leftPanGesture
:
UIPanGestureRecognizer
?
/**
:name: leftTapGesture
*/
public
var
leftTapGesture
:
UITapGestureRecognizer
?
/**
:name: leftViewControllerWidth
*/
public
var
leftViewControllerWidth
:
CGFloat
=
240
{
didSet
{
leftView
?
.
width
=
leftViewControllerWidth
MaterialAnimation
.
animationDisabled
({
self
.
leftView
!.
position
=
CGPointMake
(
-
self
.
leftView
!.
width
/
2
,
self
.
leftView
!.
height
/
2
)
})
if
let
v
=
leftView
{
v
.
width
=
leftViewControllerWidth
MaterialAnimation
.
animationDisabled
({
v
.
position
=
CGPointMake
(
-
v
.
width
/
2
,
v
.
height
/
2
)
})
}
}
}
...
...
@@ -188,7 +187,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
:name: toggleLeftViewContainer
*/
public
func
toggleLeftViewContainer
(
velocity
:
CGFloat
=
0
)
{
openLeftViewContainer
(
velocity
)
isLeftContainerOpened
?
closeLeftViewContainer
(
velocity
)
:
openLeftViewContainer
(
velocity
)
}
/**
...
...
@@ -281,36 +280,6 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
}
//
// :name: prepareGestures
//
private
func
prepareGestures
(
inout
pan
:
UIPanGestureRecognizer
?,
panSelector
:
Selector
,
inout
tap
:
UITapGestureRecognizer
?,
tapSelector
:
Selector
)
{
if
nil
==
pan
{
pan
=
UIPanGestureRecognizer
(
target
:
self
,
action
:
panSelector
)
pan
!.
delegate
=
self
view
.
addGestureRecognizer
(
pan
!
)
}
if
nil
==
tap
{
tap
=
UITapGestureRecognizer
(
target
:
self
,
action
:
tapSelector
)
tap
!.
delegate
=
self
view
.
addGestureRecognizer
(
tap
!
)
}
}
//
// :name: removeGestures
//
private
func
removeGestures
(
inout
pan
:
UIPanGestureRecognizer
?,
inout
tap
:
UITapGestureRecognizer
?)
{
if
let
g
=
pan
{
view
.
removeGestureRecognizer
(
g
)
pan
=
nil
}
if
let
g
=
tap
{
view
.
removeGestureRecognizer
(
g
)
tap
=
nil
}
}
//
// :name: handleLeftPanGesture
//
internal
func
handleLeftPanGesture
(
recognizer
:
UIPanGestureRecognizer
)
{
...
...
@@ -349,6 +318,36 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
}
//
// :name: prepareGestures
//
private
func
prepareGestures
(
inout
pan
:
UIPanGestureRecognizer
?,
panSelector
:
Selector
,
inout
tap
:
UITapGestureRecognizer
?,
tapSelector
:
Selector
)
{
if
nil
==
pan
{
pan
=
UIPanGestureRecognizer
(
target
:
self
,
action
:
panSelector
)
pan
!.
delegate
=
self
view
.
addGestureRecognizer
(
pan
!
)
}
if
nil
==
tap
{
tap
=
UITapGestureRecognizer
(
target
:
self
,
action
:
tapSelector
)
tap
!.
delegate
=
self
view
.
addGestureRecognizer
(
tap
!
)
}
}
//
// :name: removeGestures
//
private
func
removeGestures
(
inout
pan
:
UIPanGestureRecognizer
?,
inout
tap
:
UITapGestureRecognizer
?)
{
if
let
g
=
pan
{
view
.
removeGestureRecognizer
(
g
)
pan
=
nil
}
if
let
g
=
tap
{
view
.
removeGestureRecognizer
(
g
)
tap
=
nil
}
}
//
// :name: toggleStatusBar
//
private
func
toggleStatusBar
(
hide
:
Bool
=
false
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment