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
94cce7e2
Commit
94cce7e2
authored
Oct 10, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
samples issue-70: added internal delegation for TabBar to be used by TabsController
parent
5c8aa125
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
3 deletions
+20
-3
Material.xcodeproj/project.pbxproj
+1
-1
Sources/iOS/TabBar.swift
+14
-0
Sources/iOS/TabsController.swift
+5
-2
No files found.
Material.xcodeproj/project.pbxproj
View file @
94cce7e2
...
...
@@ -358,7 +358,7 @@
96BCB7971CB40DC500C806FE
/* NavigationDrawerController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
NavigationDrawerController.swift
;
sourceTree
=
"<group>"
;
};
96BCB7981CB40DC500C806FE
/* Bar.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Bar.swift
;
sourceTree
=
"<group>"
;
};
96BCB7991CB40DC500C806FE
/* TransitionController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
TransitionController.swift
;
sourceTree
=
"<group>"
;
};
96BCB79A1CB40DC500C806FE
/* TabBar.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
TabBar.swift
;
sourceTree
=
"<group>"
;
};
96BCB79A1CB40DC500C806FE
/* TabBar.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
indentWidth
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
TabBar.swift
;
sourceTree
=
"<group>"
;
tabWidth
=
4
;
};
96BCB79C1CB40DC500C806FE
/* TextField.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
TextField.swift
;
sourceTree
=
"<group>"
;
};
96BCB79D1CB40DC500C806FE
/* TextStorage.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
TextStorage.swift
;
sourceTree
=
"<group>"
;
};
96BCB79E1CB40DC500C806FE
/* TextView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
TextView.swift
;
sourceTree
=
"<group>"
;
};
...
...
Sources/iOS/TabBar.swift
View file @
94cce7e2
...
...
@@ -74,6 +74,18 @@ public protocol TabBarDelegate {
optional
func
tabBar
(
tabBar
:
TabBar
,
didSelect
tabItem
:
TabItem
)
}
@objc(_TabBarDelegate)
internal
protocol
_TabBarDelegate
{
/**
A delegation method that is executed when the tabItem will trigger the
animation to the next tab.
- Parameter tabBar: A TabBar.
- Parameter tabItem: A TabItem.
*/
@objc
optional
func
_tabBar
(
tabBar
:
TabBar
,
willSelect
tabItem
:
TabItem
)
}
@objc(TabBarStyle)
public
enum
TabBarStyle
:
Int
{
case
auto
...
...
@@ -124,6 +136,7 @@ open class TabBar: Bar {
/// A delegation reference.
open
weak
var
delegate
:
TabBarDelegate
?
internal
weak
var
_delegate
:
_TabBarDelegate
?
/// The currently selected tabItem.
open
internal(set)
var
selectedTabItem
:
TabItem
?
...
...
@@ -402,6 +415,7 @@ fileprivate extension TabBar {
*/
func
animate
(
to
tabItem
:
TabItem
,
isTriggeredByUserInteraction
:
Bool
,
completion
:
((
TabItem
)
->
Void
)?
=
nil
)
{
if
isTriggeredByUserInteraction
{
_delegate
?
.
_tabBar
?(
tabBar
:
self
,
willSelect
:
tabItem
)
delegate
?
.
tabBar
?(
tabBar
:
self
,
willSelect
:
tabItem
)
}
...
...
Sources/iOS/TabsController.swift
View file @
94cce7e2
...
...
@@ -284,6 +284,7 @@ fileprivate extension TabsController {
/// Prepares the TabBar.
func
prepareTabBar
()
{
tabBar
.
lineAlignment
=
.
bottom
==
tabBarAlignment
?
.
top
:
.
bottom
tabBar
.
_delegate
=
self
tabBar
.
delegate
=
self
view
.
addSubview
(
tabBar
)
}
...
...
@@ -378,9 +379,9 @@ extension TabsController {
}
}
extension
TabsController
:
TabBarDelegate
{
extension
TabsController
:
_
TabBarDelegate
{
@objc
open
func
tabBar
(
tabBar
:
TabBar
,
willSelect
tabItem
:
TabItem
)
{
func
_
tabBar
(
tabBar
:
TabBar
,
willSelect
tabItem
:
TabItem
)
{
guard
!
(
false
==
tabBar
.
delegate
?
.
tabBar
?(
tabBar
:
tabBar
,
shouldSelect
:
tabItem
))
else
{
return
}
...
...
@@ -406,3 +407,5 @@ extension TabsController: TabBarDelegate {
}
}
}
extension
TabsController
:
TabBarDelegate
{}
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