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
7307c49e
Unverified
Commit
7307c49e
authored
Apr 05, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: initial commit for TabMenu and TabMenuController
parent
0a2a3869
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
186 additions
and
10 deletions
+186
-10
Material.xcodeproj/project.pbxproj
+7
-3
Sources/iOS/PageTabBarController.swift
+5
-3
Sources/iOS/Photos/PhotoLibrary.swift
+1
-1
Sources/iOS/RootController.swift
+5
-3
Sources/iOS/TabMenuController.swift
+168
-0
No files found.
Material.xcodeproj/project.pbxproj
View file @
7307c49e
...
...
@@ -7,6 +7,7 @@
objects
=
{
/* Begin PBXBuildFile section */
9606CFAC1E957AC3006B4E74
/* TabMenuController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9606CFAB1E957AC3006B4E74
/* TabMenuController.swift */
;
};
961409B01E43D15C00E7BA99
/* CollectionViewCard.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
961730591E145DE900A9A297
/* CollectionViewCard.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
961409B11E43D15C00E7BA99
/* FABMenu.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96A183621E0C6CE200083C30
/* FABMenu.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
961409B21E43D15C00E7BA99
/* FABMenuController.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96A183641E0C6DD400083C30
/* FABMenuController.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
...
...
@@ -189,6 +190,7 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
9606CFAB1E957AC3006B4E74
/* TabMenuController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
TabMenuController.swift
;
sourceTree
=
"<group>"
;
};
961276621DCD8B1800A7D920
/* CharacterAttribute.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
CharacterAttribute.swift
;
sourceTree
=
"<group>"
;
};
961730591E145DE900A9A297
/* CollectionViewCard.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
CollectionViewCard.swift
;
sourceTree
=
"<group>"
;
};
961E6BDE1DDA2A95004E6C93
/* Application.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Application.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -362,12 +364,13 @@
name
=
Height
;
sourceTree
=
"<group>"
;
};
962DDD071D6FBBB7001C307C
/*
PageTabBar
*/
=
{
962DDD071D6FBBB7001C307C
/*
TabMenu
*/
=
{
isa
=
PBXGroup
;
children
=
(
963FBF071D669D14008F8512
/* PageTabBarController.swift */
,
9606CFAB1E957AC3006B4E74
/* TabMenuController.swift */
,
);
name
=
PageTabBar
;
name
=
TabMenu
;
sourceTree
=
"<group>"
;
};
962DDD081D6FBBD0001C307C
/* BottomTabBar */
=
{
...
...
@@ -527,7 +530,7 @@
96BCB8091CB4107700C806FE
/* Motion */
,
96BCB8011CB40F1700C806FE
/* Navigation */
,
961E6BEF1DDA4B04004E6C93
/* NavigationDrawer */
,
962DDD071D6FBBB7001C307C
/*
PageTabBar
*/
,
962DDD071D6FBBB7001C307C
/*
TabMenu
*/
,
96717B151DBE6B1800DA84DB
/* Photos */
,
96328B8F1E05B69A009A4C90
/* Reminders */
,
9626CA951DAB5370003E2611
/* Root */
,
...
...
@@ -992,6 +995,7 @@
965E80D81DD4C50600D61E4B
/* Layer.swift in Sources */
,
965E80D91DD4C50600D61E4B
/* Layout.swift in Sources */
,
965E80DA1DD4C50600D61E4B
/* Border.swift in Sources */
,
9606CFAC1E957AC3006B4E74
/* TabMenuController.swift in Sources */
,
965E80DB1DD4C50600D61E4B
/* InterimSpace.swift in Sources */
,
965E80DC1DD4C50600D61E4B
/* Depth.swift in Sources */
,
965E80DD1DD4C50600D61E4B
/* EdgeInsets.swift in Sources */
,
...
...
Sources/iOS/PageTabBarController.swift
View file @
7307c49e
...
...
@@ -55,7 +55,7 @@ public enum PageTabBarAlignment: Int {
}
extension
UIViewController
{
///
Grid
reference.
///
PageTabBarItem
reference.
public
private(set)
var
pageTabBarItem
:
PageTabBarItem
{
get
{
return
AssociatedObject
(
base
:
self
,
key
:
&
PageTabBarItemKey
)
{
...
...
@@ -158,7 +158,6 @@ open class PageTabBarController: RootController {
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
isBounceEnabled
=
true
super
.
init
(
coder
:
aDecoder
)
prepare
()
}
public
override
init
(
rootViewController
:
UIViewController
)
{
...
...
@@ -166,7 +165,6 @@ open class PageTabBarController: RootController {
super
.
init
(
rootViewController
:
UIPageViewController
(
transitionStyle
:
.
scroll
,
navigationOrientation
:
.
horizontal
,
options
:
nil
))
viewControllers
.
append
(
rootViewController
)
setInternalSelectedIndex
(
index
:
0
,
animated
:
true
)
prepare
()
}
public
init
(
viewControllers
:
[
UIViewController
],
selectedIndex
index
:
Int
=
0
)
{
...
...
@@ -174,6 +172,10 @@ open class PageTabBarController: RootController {
super
.
init
(
rootViewController
:
UIPageViewController
(
transitionStyle
:
.
scroll
,
navigationOrientation
:
.
horizontal
,
options
:
nil
))
self
.
viewControllers
.
append
(
contentsOf
:
viewControllers
)
setInternalSelectedIndex
(
index
:
index
,
animated
:
true
)
}
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
prepare
()
}
...
...
Sources/iOS/Photos/PhotoLibrary.swift
View file @
7307c49e
...
...
@@ -195,7 +195,7 @@ public class PhotoLibrary: NSObject {
}
/// Prepare the instance object.
private
func
prepare
()
{
open
func
prepare
()
{
prepareChangeObservers
()
}
...
...
Sources/iOS/RootController.swift
View file @
7307c49e
...
...
@@ -59,7 +59,6 @@ open class RootController: UIViewController {
*/
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
super
.
init
(
coder
:
aDecoder
)
prepare
()
}
/**
...
...
@@ -69,7 +68,6 @@ open class RootController: UIViewController {
*/
public
override
init
(
nibName
nibNameOrNil
:
String
?,
bundle
nibBundleOrNil
:
Bundle
?)
{
super
.
init
(
nibName
:
nibNameOrNil
,
bundle
:
nibBundleOrNil
)
prepare
()
}
/**
...
...
@@ -79,8 +77,12 @@ open class RootController: UIViewController {
public
init
(
rootViewController
:
UIViewController
)
{
super
.
init
(
nibName
:
nil
,
bundle
:
nil
)
self
.
rootViewController
=
rootViewController
prepare
()
}
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
prepare
()
}
open
override
func
viewWillLayoutSubviews
()
{
super
.
viewWillLayoutSubviews
()
...
...
Sources/iOS/TabMenuController.swift
0 → 100644
View file @
7307c49e
/*
* Copyright (C) 2015 - 2017, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.com>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import
UIKit
/// A memory reference to the TabMenuBarItem instance for UIViewController extensions.
fileprivate
var
TabMenuBarItemKey
:
UInt8
=
0
open
class
TabMenuBarItem
:
FlatButton
{
open
override
func
prepare
()
{
super
.
prepare
()
pulseAnimation
=
.
none
}
}
@objc(TabMenuAlignment)
public
enum
TabMenuAlignment
:
Int
{
case
top
case
bottom
}
open
class
TabMenu
:
UIView
{
@IBInspectable
open
var
tabBar
=
TabBar
()
{
didSet
{
layoutSubviews
()
}
}
open
var
viewControllers
:
[
UIViewController
]
open
var
selectedIndex
:
Int
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
viewControllers
=
[]
selectedIndex
=
0
fatalError
(
"init(coder:) has not been implemented"
)
}
public
init
(
viewControllers
:
[
UIViewController
],
selectedIndex
:
Int
=
0
)
{
self
.
viewControllers
=
viewControllers
self
.
selectedIndex
=
selectedIndex
super
.
init
(
frame
:
.
zero
)
}
open
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
}
/**
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepare method
to initialize property values and other setup operations.
The super.prepare method should always be called immediately
when subclassing.
*/
open
func
prepare
()
{
prepareTabBar
()
}
}
extension
TabMenu
{
fileprivate
func
prepareTabBar
()
{
tabBar
.
isLineAnimated
=
false
tabBar
.
lineAlignment
=
.
top
}
}
extension
UIViewController
{
/// tabMenuBarItem reference.
public
private(set)
var
tabMenuBarItem
:
TabMenuBarItem
{
get
{
return
AssociatedObject
(
base
:
self
,
key
:
&
TabMenuBarItemKey
)
{
return
TabMenuBarItem
()
}
}
set
(
value
)
{
AssociateObject
(
base
:
self
,
key
:
&
TabMenuBarItemKey
,
value
:
value
)
}
}
}
extension
UIViewController
{
/**
A convenience property that provides access to the TabMenuController.
This is the recommended method of accessing the TabMenuController
through child UIViewControllers.
*/
public
var
tabMenuBarController
:
TabMenuController
?
{
var
viewController
:
UIViewController
?
=
self
while
nil
!=
viewController
{
if
viewController
is
TabMenuController
{
return
viewController
as?
TabMenuController
}
viewController
=
viewController
?
.
parent
}
return
nil
}
}
open
class
TabMenuController
:
UIViewController
{
/// A reference to the TabMenu instance.
@IBInspectable
open
let
tabMenu
:
TabMenu
/**
An initializer that initializes the object with a NSCoder object.
- Parameter aDecoder: A NSCoder instance.
*/
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
tabMenu
=
TabMenu
(
viewControllers
:
[])
super
.
init
(
coder
:
aDecoder
)
}
/**
An initializer that accepts an Array of UIViewControllers.
- Parameter viewControllers: An Array of UIViewControllers.
*/
public
init
(
viewControllers
:
[
UIViewController
],
selectedIndex
:
Int
=
0
)
{
tabMenu
=
TabMenu
(
viewControllers
:
viewControllers
,
selectedIndex
:
selectedIndex
)
super
.
init
(
nibName
:
nil
,
bundle
:
nil
)
}
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
prepare
()
}
/**
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepare method
to initialize property values and other setup operations.
The super.prepare method should always be called immediately
when subclassing.
*/
open
func
prepare
()
{
}
}
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