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
93842963
Commit
93842963
authored
Aug 18, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: addition of TabBarController with RootController
parent
b009452c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
211 additions
and
52 deletions
+211
-52
Material.xcodeproj/project.pbxproj
+4
-0
Sources/iOS/ControlView.swift
+4
-3
Sources/iOS/PageController.swift
+2
-4
Sources/iOS/SearchBarController.swift
+27
-25
Sources/iOS/TabBar.swift
+47
-3
Sources/iOS/TabBarController.swift
+108
-0
Sources/iOS/ToolbarController.swift
+19
-17
No files found.
Material.xcodeproj/project.pbxproj
View file @
93842963
...
...
@@ -16,6 +16,7 @@
963832421B88DFD80015F710
/* Material.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
963832361B88DFD80015F710
/* Material.framework */
;
};
963FBEFD1D669510008F8512
/* Snackbar.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
963FBEFC1D669510008F8512
/* Snackbar.swift */
;
};
963FBF051D669713008F8512
/* PageController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
963FBF041D669713008F8512
/* PageController.swift */
;
};
963FBF081D669D14008F8512
/* TabBarController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
963FBF071D669D14008F8512
/* TabBarController.swift */
;
};
9658F2171CD6FA4700B902C1
/* IconButton.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9658F2161CD6FA4700B902C1
/* IconButton.swift */
;
};
9660161D1CB2ED6C00AAB661
/* Material.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
966016131CB2ED6C00AAB661
/* Material.framework */
;
};
9660162A1CB2F04E00AAB661
/* Material.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96D88C091C1328D800B91418
/* Material.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
...
...
@@ -210,6 +211,7 @@
963832591B88E31A0015F710
/* Info.plist */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
text.plist.xml
;
path
=
Info.plist
;
sourceTree
=
"<group>"
;
};
963FBEFC1D669510008F8512
/* Snackbar.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Snackbar.swift
;
sourceTree
=
"<group>"
;
};
963FBF041D669713008F8512
/* PageController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
PageController.swift
;
sourceTree
=
"<group>"
;
};
963FBF071D669D14008F8512
/* TabBarController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
TabBarController.swift
;
sourceTree
=
"<group>"
;
};
9658F2161CD6FA4700B902C1
/* IconButton.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
IconButton.swift
;
sourceTree
=
"<group>"
;
};
966016131CB2ED6C00AAB661
/* Material.framework */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.framework
;
includeInIndex
=
0
;
path
=
Material.framework
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
9660161C1CB2ED6C00AAB661
/* Material macOS Tests.xctest */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.cfbundle
;
includeInIndex
=
0
;
path
=
"Material macOS Tests.xctest"
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
...
...
@@ -400,6 +402,7 @@
isa
=
PBXGroup
;
children
=
(
96BCB79A1CB40DC500C806FE
/* TabBar.swift */
,
963FBF071D669D14008F8512
/* TabBarController.swift */
,
963FBF041D669713008F8512
/* PageController.swift */
,
);
name
=
TabBar
;
...
...
@@ -1052,6 +1055,7 @@
962864621D54111D00690B69
/* JSON.swift in Sources */
,
96BCB7C21CB40DC500C806FE
/* Device.swift in Sources */
,
96BCB7A41CB40DC500C806FE
/* CaptureSession.swift in Sources */
,
963FBF081D669D14008F8512
/* TabBarController.swift in Sources */
,
963FBEFD1D669510008F8512
/* Snackbar.swift in Sources */
,
96BCB7C51CB40DC500C806FE
/* MaterialGravity.swift in Sources */
,
968C99471D377849000074FF
/* Offset.swift in Sources */
,
...
...
Sources/iOS/ControlView.swift
View file @
93842963
...
...
@@ -47,7 +47,8 @@ open class ControlView: View {
}
/// A wrapper around grid.contentInset.
@IBInspectable
open
var
contentInset
:
EdgeInsets
{
@IBInspectable
open
var
contentInset
:
EdgeInsets
{
get
{
return
grid
.
contentEdgeInsets
}
...
...
@@ -64,7 +65,8 @@ open class ControlView: View {
}
/// A wrapper around grid.interimSpace.
@IBInspectable
open
var
interimSpace
:
InterimSpace
{
@IBInspectable
open
var
interimSpace
:
InterimSpace
{
get
{
return
grid
.
interimSpace
}
...
...
@@ -222,7 +224,6 @@ open class ControlView: View {
interimSpacePreset
=
.
interimSpace1
contentEdgeInsetsPreset
=
.
square1
autoresizingMask
=
.
flexibleWidth
isShadowPathAutoSizing
=
false
prepareContentView
()
}
...
...
Sources/iOS/PageController.swift
View file @
93842963
...
...
@@ -38,9 +38,7 @@ open class PageController: UIPageViewController {
The super.prepareView method should always be called immediately
when subclassing.
*/
open
override
func
prepareView
()
{
autoresizingMask
=
.
flexibleWidth
contentScaleFactor
=
Device
.
scale
prepareLine
()
open
func
prepareView
()
{
}
}
Sources/iOS/SearchBarController.swift
View file @
93842963
...
...
@@ -50,43 +50,45 @@ extension UIViewController {
open
class
SearchBarController
:
RootController
{
/// Reference to the SearchBar.
open
private
(set)
var
searchBar
:
SearchBar
!
open
internal
(set)
var
searchBar
:
SearchBar
!
/**
To execute in the order of the layout chain, override this
method. LayoutSubviews should be called immediately, unless you
have a certain need.
*/
To execute in the order of the layout chain, override this
method. LayoutSubviews should be called immediately, unless you
have a certain need.
*/
open
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
if
let
v
:
SearchBar
=
searchBar
{
v
.
grid
.
layoutEdgeInsets
.
top
=
.
phone
==
Device
.
userInterfaceIdiom
&&
Device
.
isLandscape
?
0
:
20
let
h
:
CGFloat
=
Device
.
height
let
w
:
CGFloat
=
Device
.
width
let
p
:
CGFloat
=
v
.
intrinsicContentSize
.
height
+
v
.
grid
.
layoutEdgeInsets
.
top
+
v
.
grid
.
layoutEdgeInsets
.
bottom
v
.
width
=
w
+
v
.
grid
.
layoutEdgeInsets
.
left
+
v
.
grid
.
layoutEdgeInsets
.
right
v
.
height
=
p
rootViewController
.
view
.
frame
.
origin
.
y
=
p
rootViewController
.
view
.
frame
.
size
.
height
=
h
-
p
}
guard
let
v
=
searchBar
else
{
return
}
v
.
grid
.
layoutEdgeInsets
.
top
=
.
phone
==
Device
.
userInterfaceIdiom
&&
Device
.
isLandscape
?
0
:
20
let
h
=
Device
.
height
let
w
=
Device
.
width
let
p
=
v
.
intrinsicContentSize
.
height
+
v
.
grid
.
layoutEdgeInsets
.
top
+
v
.
grid
.
layoutEdgeInsets
.
bottom
v
.
width
=
w
+
v
.
grid
.
layoutEdgeInsets
.
left
+
v
.
grid
.
layoutEdgeInsets
.
right
v
.
height
=
p
rootViewController
.
view
.
frame
.
origin
.
y
=
p
rootViewController
.
view
.
frame
.
size
.
height
=
h
-
p
}
/**
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepareView method
to initialize property values and other setup operations.
The super.prepareView method should always be called immediately
when subclassing.
*/
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepareView method
to initialize property values and other setup operations.
The super.prepareView method should always be called immediately
when subclassing.
*/
open
override
func
prepareView
()
{
super
.
prepareView
()
prepareSearchBar
()
}
/// Prepares the
S
earchBar.
/// Prepares the
s
earchBar.
private
func
prepareSearchBar
()
{
if
nil
==
searchBar
{
searchBar
=
SearchBar
()
...
...
Sources/iOS/TabBar.swift
View file @
93842963
...
...
@@ -51,7 +51,50 @@ open class TabBar: View {
open
var
willRenderView
:
Bool
{
return
0
<
width
&&
0
<
height
&&
nil
!=
superview
}
/// A preset wrapper around contentInset.
open
var
contentEdgeInsetsPreset
:
EdgeInsetsPreset
{
get
{
return
grid
.
contentEdgeInsetsPreset
}
set
(
value
)
{
grid
.
contentEdgeInsetsPreset
=
value
}
}
/// A wrapper around grid.contentInset.
@IBInspectable
open
var
contentInset
:
EdgeInsets
{
get
{
return
grid
.
contentEdgeInsets
}
set
(
value
)
{
grid
.
contentEdgeInsets
=
value
}
}
/// A preset wrapper around interimSpace.
open
var
interimSpacePreset
:
InterimSpacePreset
=
.
none
{
didSet
{
interimSpace
=
InterimSpacePresetToValue
(
preset
:
interimSpacePreset
)
}
}
/// A wrapper around grid.interimSpace.
@IBInspectable
open
var
interimSpace
:
InterimSpace
{
get
{
return
grid
.
interimSpace
}
set
(
value
)
{
grid
.
interimSpace
=
value
}
}
open
override
var
intrinsicContentSize
:
CGSize
{
return
CGSize
(
width
:
width
,
height
:
44
)
}
/// Buttons.
open
var
buttons
:
[
UIButton
]?
{
didSet
{
...
...
@@ -110,9 +153,10 @@ open class TabBar: View {
*/
open
override
func
prepareView
()
{
super
.
prepareView
()
autoresizingMask
=
.
flexibleWidth
contentScaleFactor
=
Device
.
scale
prepareLine
()
interimSpacePreset
=
.
interimSpace1
contentEdgeInsetsPreset
=
.
square1
autoresizingMask
=
.
flexibleWidth
prepareLine
()
}
// Prepares the line.
...
...
Sources/iOS/TabBarController.swift
0 → 100644
View file @
93842963
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* 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
//extension UIViewController {
// /**
// A convenience property that provides access to the TabBarController.
// This is the recommended method of accessing the TabBarController
// through child UIViewControllers.
// */
// public var tabBarController: TabBarController? {
// var viewController: UIViewController? = self
// while nil != viewController {
// if viewController is TabBarController {
// return viewController as? TabBarController
// }
// viewController = viewController?.parent
// }
// return nil
// }
//}
@objc(TabBarControllerDelegate)
public
protocol
TabBarControllerDelegate
:
MaterialDelegate
{
}
@objc(TabBarController)
open
class
TabBarController
:
RootController
{
/// Reference to the TabBar.
open
internal(set)
var
tabBar
:
TabBar
!
/// Delegation handler.
public
weak
var
delegate
:
TabBarControllerDelegate
?
/**
To execute in the order of the layout chain, override this
method. LayoutSubviews should be called immediately, unless you
have a certain need.
*/
open
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
guard
let
v
=
tabBar
else
{
return
}
let
h
=
Device
.
height
let
w
=
Device
.
width
let
p
=
v
.
intrinsicContentSize
.
height
+
v
.
grid
.
layoutEdgeInsets
.
top
+
v
.
grid
.
layoutEdgeInsets
.
bottom
let
y
=
h
-
p
v
.
y
=
y
v
.
width
=
w
+
v
.
grid
.
layoutEdgeInsets
.
left
+
v
.
grid
.
layoutEdgeInsets
.
right
v
.
height
=
p
rootViewController
.
view
.
frame
.
origin
.
y
=
0
rootViewController
.
view
.
frame
.
size
.
height
=
y
}
/**
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepareView method
to initialize property values and other setup operations.
The super.prepareView method should always be called immediately
when subclassing.
*/
open
override
func
prepareView
()
{
super
.
prepareView
()
prepareTabBar
()
}
/// Prepares the tabBar.
private
func
prepareTabBar
()
{
if
nil
==
tabBar
{
tabBar
=
TabBar
()
tabBar
.
zPosition
=
1000
view
.
addSubview
(
tabBar
)
}
}
}
Sources/iOS/ToolbarController.swift
View file @
93842963
...
...
@@ -49,7 +49,7 @@ extension UIViewController {
}
@objc(ToolbarControllerDelegate)
public
protocol
ToolbarControllerDelegate
:
MaterialDelegate
{
public
protocol
ToolbarControllerDelegate
:
MaterialDelegate
{
/// Delegation method that executes when the floatingViewController will open.
@objc
optional
func
toolbarControllerWillOpenFloatingViewController
(
toolbarController
:
ToolbarController
)
...
...
@@ -73,7 +73,7 @@ open class ToolbarController: RootController {
private
var
internalFloatingViewController
:
UIViewController
?
/// Reference to the Toolbar.
public
private
(set)
var
toolbar
:
Toolbar
!
open
internal
(set)
var
toolbar
:
Toolbar
!
/// Delegation handler.
public
weak
var
delegate
:
ToolbarControllerDelegate
?
...
...
@@ -162,19 +162,21 @@ open class ToolbarController: RootController {
*/
open
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
if
let
v
:
Toolbar
=
toolbar
{
v
.
grid
.
layoutEdgeInsets
.
top
=
.
phone
==
Device
.
userInterfaceIdiom
&&
Device
.
isLandscape
?
0
:
20
let
h
:
CGFloat
=
Device
.
height
let
w
:
CGFloat
=
Device
.
width
let
p
:
CGFloat
=
v
.
intrinsicContentSize
.
height
+
v
.
grid
.
layoutEdgeInsets
.
top
+
v
.
grid
.
layoutEdgeInsets
.
bottom
v
.
width
=
w
+
v
.
grid
.
layoutEdgeInsets
.
left
+
v
.
grid
.
layoutEdgeInsets
.
right
v
.
height
=
p
rootViewController
.
view
.
frame
.
origin
.
y
=
p
rootViewController
.
view
.
frame
.
size
.
height
=
h
-
p
}
guard
let
v
=
toolbar
else
{
return
}
v
.
grid
.
layoutEdgeInsets
.
top
=
.
phone
==
Device
.
userInterfaceIdiom
&&
Device
.
isLandscape
?
0
:
20
let
h
=
Device
.
height
let
w
=
Device
.
width
let
p
=
v
.
intrinsicContentSize
.
height
+
v
.
grid
.
layoutEdgeInsets
.
top
+
v
.
grid
.
layoutEdgeInsets
.
bottom
v
.
width
=
w
+
v
.
grid
.
layoutEdgeInsets
.
left
+
v
.
grid
.
layoutEdgeInsets
.
right
v
.
height
=
p
rootViewController
.
view
.
frame
.
origin
.
y
=
p
rootViewController
.
view
.
frame
.
size
.
height
=
h
-
p
}
/**
...
...
@@ -186,11 +188,11 @@ open class ToolbarController: RootController {
*/
open
override
func
prepareView
()
{
super
.
prepareView
()
prepareT
oolb
ar
()
prepareT
abB
ar
()
}
/// Prepares the Toolbar.
private
func
prepareT
oolb
ar
()
{
private
func
prepareT
abB
ar
()
{
if
nil
==
toolbar
{
toolbar
=
Toolbar
()
toolbar
.
zPosition
=
1000
...
...
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