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
ec3e3e8c
Unverified
Commit
ec3e3e8c
authored
Jul 04, 2018
by
Daniel Dahan
Committed by
GitHub
Jul 04, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1111 from OrkhanAlikhanov/fix-swipe
Fixed tabItem was not changed on swipe
parents
6b989a48
b7ee72bb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
Sources/iOS/TabsController.swift
+9
-5
No files found.
Sources/iOS/TabsController.swift
View file @
ec3e3e8c
...
@@ -373,10 +373,10 @@ fileprivate extension TabsController {
...
@@ -373,10 +373,10 @@ fileprivate extension TabsController {
switch
swipeGesture
.
direction
{
switch
swipeGesture
.
direction
{
case
.
right
:
case
.
right
:
guard
(
selectedIndex
-
1
)
>=
0
else
{
return
}
guard
(
selectedIndex
-
1
)
>=
0
else
{
return
}
internalSelect
(
at
:
selectedIndex
-
1
,
isTriggeredByUserInteraction
:
true
)
internalSelect
(
at
:
selectedIndex
-
1
,
isTriggeredByUserInteraction
:
true
,
selectTabItem
:
true
)
case
.
left
:
case
.
left
:
guard
(
selectedIndex
+
1
)
<
viewControllers
.
count
else
{
return
}
guard
(
selectedIndex
+
1
)
<
viewControllers
.
count
else
{
return
}
internalSelect
(
at
:
selectedIndex
+
1
,
isTriggeredByUserInteraction
:
true
)
internalSelect
(
at
:
selectedIndex
+
1
,
isTriggeredByUserInteraction
:
true
,
selectTabItem
:
true
)
default
:
default
:
break
break
}
}
...
@@ -390,7 +390,7 @@ extension TabsController {
...
@@ -390,7 +390,7 @@ extension TabsController {
- Parameter at index: An Int.
- Parameter at index: An Int.
*/
*/
open
func
select
(
at
index
:
Int
)
{
open
func
select
(
at
index
:
Int
)
{
internalSelect
(
at
:
index
,
isTriggeredByUserInteraction
:
false
)
internalSelect
(
at
:
index
,
isTriggeredByUserInteraction
:
false
,
selectTabItem
:
true
)
}
}
/**
/**
...
@@ -401,7 +401,7 @@ extension TabsController {
...
@@ -401,7 +401,7 @@ extension TabsController {
- Returns: A boolean indicating whether the transition will take place.
- Returns: A boolean indicating whether the transition will take place.
*/
*/
@discardableResult
@discardableResult
private
func
internalSelect
(
at
index
:
Int
,
isTriggeredByUserInteraction
:
Bool
)
->
Bool
{
private
func
internalSelect
(
at
index
:
Int
,
isTriggeredByUserInteraction
:
Bool
,
selectTabItem
:
Bool
)
->
Bool
{
guard
index
!=
selectedIndex
else
{
guard
index
!=
selectedIndex
else
{
return
false
return
false
}
}
...
@@ -412,6 +412,10 @@ extension TabsController {
...
@@ -412,6 +412,10 @@ extension TabsController {
}
}
}
}
if
selectTabItem
{
tabBar
.
select
(
at
:
index
)
}
transition
(
to
:
viewControllers
[
index
],
isTriggeredByUserInteraction
:
isTriggeredByUserInteraction
)
{
[
weak
self
]
(
isFinishing
)
in
transition
(
to
:
viewControllers
[
index
],
isTriggeredByUserInteraction
:
isTriggeredByUserInteraction
)
{
[
weak
self
]
(
isFinishing
)
in
guard
isFinishing
else
{
guard
isFinishing
else
{
return
return
...
@@ -431,6 +435,6 @@ extension TabsController: _TabBarDelegate {
...
@@ -431,6 +435,6 @@ extension TabsController: _TabBarDelegate {
return
false
return
false
}
}
return
internalSelect
(
at
:
i
,
isTriggeredByUserInteraction
:
true
)
return
internalSelect
(
at
:
i
,
isTriggeredByUserInteraction
:
true
,
selectTabItem
:
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