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
6e0141ee
Unverified
Commit
6e0141ee
authored
Jan 01, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: working BottomSheetController
parent
1236e286
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
29 deletions
+12
-29
Sources/iOS/BottomSheetController.swift
+12
-29
No files found.
Sources/iOS/BottomSheetController.swift
View file @
6e0141ee
...
@@ -60,86 +60,69 @@ public protocol BottomSheetControllerDelegate {
...
@@ -60,86 +60,69 @@ public protocol BottomSheetControllerDelegate {
An optional delegation method that is fired before the
An optional delegation method that is fired before the
BottomSheetController opens.
BottomSheetController opens.
- Parameter bottomSheetController: A BottomSheetController.
- Parameter bottomSheetController: A BottomSheetController.
- Parameter position: The BottomSheetPosition.
*/
*/
@objc
@objc
optional
func
bottomSheetController
(
bottomSheetController
:
BottomSheetController
,
willOpen
position
:
BottomSheetPosition
)
optional
func
bottomSheetController
WillOpen
(
bottomSheetController
:
BottomSheetController
)
/**
/**
An optional delegation method that is fired after the
An optional delegation method that is fired after the
BottomSheetController opened.
BottomSheetController opened.
- Parameter bottomSheetController: A BottomSheetController.
- Parameter bottomSheetController: A BottomSheetController.
- Parameter position: The BottomSheetPosition.
*/
*/
@objc
@objc
optional
func
bottomSheetController
(
bottomSheetController
:
BottomSheetController
,
didOpen
position
:
BottomSheetPosition
)
optional
func
bottomSheetController
DidOpen
(
bottomSheetController
:
BottomSheetController
)
/**
/**
An optional delegation method that is fired before the
An optional delegation method that is fired before the
BottomSheetController closes.
BottomSheetController closes.
- Parameter bottomSheetController: A BottomSheetController.
- Parameter bottomSheetController: A BottomSheetController.
- Parameter position: The BottomSheetPosition.
*/
*/
@objc
@objc
optional
func
bottomSheetController
(
bottomSheetController
:
BottomSheetController
,
willClose
position
:
BottomSheetPosition
)
optional
func
bottomSheetController
WillClose
(
bottomSheetController
:
BottomSheetController
)
/**
/**
An optional delegation method that is fired after the
An optional delegation method that is fired after the
BottomSheetController closed.
BottomSheetController closed.
- Parameter bottomSheetController: A BottomSheetController.
- Parameter bottomSheetController: A BottomSheetController.
- Parameter position: The BottomSheetPosition.
*/
*/
@objc
@objc
optional
func
bottomSheetController
(
bottomSheetController
:
BottomSheetController
,
didClose
position
:
BottomSheetPosition
)
optional
func
bottomSheetController
DidClose
(
bottomSheetController
:
BottomSheetController
)
/**
/**
An optional delegation method that is fired when the
An optional delegation method that is fired when the
BottomSheetController pan gesture begins.
BottomSheetController pan gesture begins.
- Parameter bottomSheetController: A BottomSheetController.
- Parameter bottomSheetController: A BottomSheetController.
- Parameter didBeginPanAt point: A CGPoint.
- Parameter didBeginPanAt point: A CGPoint.
- Parameter position: The BottomSheetPosition.
*/
*/
@objc
@objc
optional
func
bottomSheetController
(
bottomSheetController
:
BottomSheetController
,
didBeginPanAt
point
:
CGPoint
,
position
:
BottomSheetPosition
)
optional
func
bottomSheetController
(
bottomSheetController
:
BottomSheetController
,
didBeginPanAt
point
:
CGPoint
)
/**
/**
An optional delegation method that is fired when the
An optional delegation method that is fired when the
BottomSheetController pan gesture changes position.
BottomSheetController pan gesture changes position.
- Parameter bottomSheetController: A BottomSheetController.
- Parameter bottomSheetController: A BottomSheetController.
- Parameter didChangePanAt point: A CGPoint.
- Parameter didChangePanAt point: A CGPoint.
- Parameter position: The BottomSheetPosition.
*/
*/
@objc
@objc
optional
func
bottomSheetController
(
bottomSheetController
:
BottomSheetController
,
didChangePanAt
point
:
CGPoint
,
position
:
BottomSheetPosition
)
optional
func
bottomSheetController
(
bottomSheetController
:
BottomSheetController
,
didChangePanAt
point
:
CGPoint
)
/**
/**
An optional delegation method that is fired when the
An optional delegation method that is fired when the
BottomSheetController pan gesture ends.
BottomSheetController pan gesture ends.
- Parameter bottomSheetController: A BottomSheetController.
- Parameter bottomSheetController: A BottomSheetController.
- Parameter didEndPanAt point: A CGPoint.
- Parameter didEndPanAt point: A CGPoint.
- Parameter position: The BottomSheetPosition.
*/
*/
@objc
@objc
optional
func
bottomSheetController
(
bottomSheetController
:
BottomSheetController
,
didEndPanAt
point
:
CGPoint
,
position
:
BottomSheetPosition
)
optional
func
bottomSheetController
(
bottomSheetController
:
BottomSheetController
,
didEndPanAt
point
:
CGPoint
)
/**
/**
An optional delegation method that is fired when the
An optional delegation method that is fired when the
BottomSheetController tap gesture executes.
BottomSheetController tap gesture executes.
- Parameter bottomSheetController: A BottomSheetController.
- Parameter bottomSheetController: A BottomSheetController.
- Parameter didTapAt point: A CGPoint.
- Parameter didTapAt point: A CGPoint.
- Parameter position: The BottomSheetPosition.
*/
*/
@objc
@objc
optional
func
bottomSheetController
(
bottomSheetController
:
BottomSheetController
,
didTapAt
point
:
CGPoint
,
position
:
BottomSheetPosition
)
optional
func
bottomSheetController
(
bottomSheetController
:
BottomSheetController
,
didTapAt
point
:
CGPoint
)
/**
An optional delegation method that is fired when the
status bar is about to change display, isHidden or not.
- Parameter bottomSheetController: A BottomSheetController.
- Parameter statusBar isHidden: A boolean.
*/
@objc
optional
func
bottomSheetController
(
bottomSheetController
:
BottomSheetController
,
statusBar
isHidden
:
Bool
)
}
}
@objc(BottomSheetController)
@objc(BottomSheetController)
...
@@ -659,7 +642,7 @@ extension BottomSheetController: UIGestureRecognizerDelegate {
...
@@ -659,7 +642,7 @@ extension BottomSheetController: UIGestureRecognizerDelegate {
*/
*/
@objc
@objc
fileprivate
func
handleBottomViewPanGesture
(
recognizer
:
UIPanGestureRecognizer
)
{
fileprivate
func
handleBottomViewPanGesture
(
recognizer
:
UIPanGestureRecognizer
)
{
guard
isBottomViewEnabled
&&
(
isBottomViewOpened
&&
isPointContainedWithinBottomThreshold
(
point
:
recognizer
.
location
(
in
:
view
)))
else
{
guard
isBottomViewEnabled
&&
(
isBottomViewOpened
||
isPointContainedWithinBottomThreshold
(
point
:
recognizer
.
location
(
in
:
view
)))
else
{
return
return
}
}
...
@@ -675,7 +658,7 @@ extension BottomSheetController: UIGestureRecognizerDelegate {
...
@@ -675,7 +658,7 @@ extension BottomSheetController: UIGestureRecognizerDelegate {
originalY
=
v
.
position
.
y
originalY
=
v
.
position
.
y
showView
(
container
:
v
)
showView
(
container
:
v
)
delegate
?
.
bottomSheetController
?(
bottomSheetController
:
self
,
didBeginPanAt
:
point
,
position
:
.
right
)
delegate
?
.
bottomSheetController
?(
bottomSheetController
:
self
,
didBeginPanAt
:
point
)
case
.
changed
:
case
.
changed
:
let
h
=
v
.
bounds
.
height
let
h
=
v
.
bounds
.
height
let
translationY
=
recognizer
.
translation
(
in
:
v
)
.
y
let
translationY
=
recognizer
.
translation
(
in
:
v
)
.
y
...
@@ -685,12 +668,12 @@ extension BottomSheetController: UIGestureRecognizerDelegate {
...
@@ -685,12 +668,12 @@ extension BottomSheetController: UIGestureRecognizerDelegate {
let
a
=
1
-
(
view
.
bounds
.
height
-
v
.
position
.
y
)
/
v
.
bounds
.
height
let
a
=
1
-
(
view
.
bounds
.
height
-
v
.
position
.
y
)
/
v
.
bounds
.
height
rootViewController
.
view
.
alpha
=
0.5
<
a
&&
v
.
position
.
y
>=
v
.
bounds
.
height
/
2
?
a
:
0.5
rootViewController
.
view
.
alpha
=
0.5
<
a
&&
v
.
position
.
y
>=
v
.
bounds
.
height
/
2
?
a
:
0.5
delegate
?
.
bottomSheetController
?(
bottomSheetController
:
self
,
didChangePanAt
:
point
,
position
:
.
right
)
delegate
?
.
bottomSheetController
?(
bottomSheetController
:
self
,
didChangePanAt
:
point
)
case
.
ended
,
.
cancelled
,
.
failed
:
case
.
ended
,
.
cancelled
,
.
failed
:
let
p
=
recognizer
.
velocity
(
in
:
recognizer
.
view
)
let
p
=
recognizer
.
velocity
(
in
:
recognizer
.
view
)
let
y
=
p
.
y
>=
1000
||
p
.
y
<=
-
1000
?
p
.
y
:
0
let
y
=
p
.
y
>=
1000
||
p
.
y
<=
-
1000
?
p
.
y
:
0
delegate
?
.
bottomSheetController
?(
bottomSheetController
:
self
,
didEndPanAt
:
point
,
position
:
.
right
)
delegate
?
.
bottomSheetController
?(
bottomSheetController
:
self
,
didEndPanAt
:
point
)
if
v
.
y
>=
bottomViewThreshold
||
y
>
1000
{
if
v
.
y
>=
bottomViewThreshold
||
y
>
1000
{
closeBottomView
(
velocity
:
y
)
closeBottomView
(
velocity
:
y
)
...
...
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