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
0bea0f61
Unverified
Commit
0bea0f61
authored
Dec 02, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: updates to Grid and shape calculations
parent
402084c6
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
43 additions
and
65 deletions
+43
-65
Sources/iOS/Bar.swift
+4
-0
Sources/iOS/BottomTabBar.swift
+2
-6
Sources/iOS/Button.swift
+2
-6
Sources/iOS/CollectionReusableView.swift
+3
-7
Sources/iOS/CollectionViewCell.swift
+3
-7
Sources/iOS/Grid.swift
+1
-0
Sources/iOS/Material+CALayer.swift
+4
-4
Sources/iOS/NavigationBar.swift
+1
-5
Sources/iOS/NavigationController.swift
+6
-0
Sources/iOS/TableViewCell.swift
+3
-7
Sources/iOS/TextField.swift
+6
-8
Sources/iOS/TextView.swift
+4
-7
Sources/iOS/Toolbar.swift
+2
-2
Sources/iOS/View.swift
+2
-6
No files found.
Sources/iOS/Bar.swift
View file @
0bea0f61
...
@@ -180,6 +180,10 @@ open class Bar: View {
...
@@ -180,6 +180,10 @@ open class Bar: View {
return
return
}
}
guard
!
grid
.
deferred
else
{
return
}
reload
()
reload
()
}
}
...
...
Sources/iOS/BottomTabBar.swift
View file @
0bea0f61
...
@@ -74,13 +74,9 @@ open class BottomTabBar: UITabBar {
...
@@ -74,13 +74,9 @@ open class BottomTabBar: UITabBar {
prepare
()
prepare
()
}
}
open
override
func
layoutSublayers
(
of
layer
:
CALayer
)
{
open
override
func
layoutSubviews
()
{
super
.
layoutSublayers
(
of
:
layer
)
layoutShape
()
}
open
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
super
.
layoutSubviews
()
layoutShape
()
layoutShadowPath
()
layoutShadowPath
()
if
let
v
=
items
{
if
let
v
=
items
{
...
...
Sources/iOS/Button.swift
View file @
0bea0f61
...
@@ -163,14 +163,10 @@ open class Button: UIButton, Pulseable {
...
@@ -163,14 +163,10 @@ open class Button: UIButton, Pulseable {
prepare
()
prepare
()
}
}
open
override
func
layoutSublayers
(
of
layer
:
CALayer
)
{
super
.
layoutSublayers
(
of
:
layer
)
layoutShape
()
layoutVisualLayer
()
}
open
override
func
layoutSubviews
()
{
open
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
super
.
layoutSubviews
()
layoutShape
()
layoutVisualLayer
()
layoutShadowPath
()
layoutShadowPath
()
}
}
...
...
Sources/iOS/CollectionReusableView.swift
View file @
0bea0f61
...
@@ -217,15 +217,11 @@ open class CollectionReusableView: UICollectionReusableView, Pulseable {
...
@@ -217,15 +217,11 @@ open class CollectionReusableView: UICollectionReusableView, Pulseable {
self
.
init
(
frame
:
.
zero
)
self
.
init
(
frame
:
.
zero
)
}
}
open
override
func
layoutSublayers
(
of
layer
:
CALayer
)
{
super
.
layoutSublayers
(
of
:
layer
)
layoutShape
()
layoutVisualLayer
()
}
open
override
func
layoutSubviews
()
{
open
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
super
.
layoutSubviews
()
layoutShadowPath
()
layoutShape
()
layoutVisualLayer
()
layoutShadowPath
()
}
}
/**
/**
...
...
Sources/iOS/CollectionViewCell.swift
View file @
0bea0f61
...
@@ -224,15 +224,11 @@ open class CollectionViewCell: UICollectionViewCell, Pulseable {
...
@@ -224,15 +224,11 @@ open class CollectionViewCell: UICollectionViewCell, Pulseable {
self
.
init
(
frame
:
.
zero
)
self
.
init
(
frame
:
.
zero
)
}
}
open
override
func
layoutSublayers
(
of
layer
:
CALayer
)
{
super
.
layoutSublayers
(
of
:
layer
)
layoutShape
()
layoutVisualLayer
()
}
open
override
func
layoutSubviews
()
{
open
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
super
.
layoutSubviews
()
layoutShadowPath
()
layoutShape
()
layoutVisualLayer
()
layoutShadowPath
()
}
}
/**
/**
...
...
Sources/iOS/Grid.swift
View file @
0bea0f61
...
@@ -204,6 +204,7 @@ public struct Grid {
...
@@ -204,6 +204,7 @@ public struct Grid {
}
}
}
}
canvas
.
setNeedsLayout
()
canvas
.
layoutIfNeeded
()
canvas
.
layoutIfNeeded
()
guard
0
<
canvas
.
width
&&
0
<
canvas
.
height
else
{
guard
0
<
canvas
.
width
&&
0
<
canvas
.
height
else
{
...
...
Sources/iOS/Material+CALayer.swift
View file @
0bea0f61
...
@@ -310,10 +310,10 @@ extension CALayer {
...
@@ -310,10 +310,10 @@ extension CALayer {
/// Manages the layout for the shape of the view instance.
/// Manages the layout for the shape of the view instance.
open
func
layoutShape
()
{
open
func
layoutShape
()
{
if
.
none
!=
shapePreset
{
if
.
none
!=
shapePreset
{
if
width
<
height
{
if
frame
.
height
>
frame
.
width
{
frame
.
size
.
width
=
height
frame
.
size
.
width
=
frame
.
height
}
else
if
width
>
height
{
}
else
if
frame
.
height
<
frame
.
width
{
frame
.
size
.
height
=
width
frame
.
size
.
height
=
frame
.
width
}
}
}
}
...
...
Sources/iOS/NavigationBar.swift
View file @
0bea0f61
...
@@ -132,13 +132,9 @@ open class NavigationBar: UINavigationBar {
...
@@ -132,13 +132,9 @@ open class NavigationBar: UINavigationBar {
return
intrinsicContentSize
return
intrinsicContentSize
}
}
open
override
func
layoutSublayers
(
of
layer
:
CALayer
)
{
super
.
layoutSublayers
(
of
:
layer
)
layoutShape
()
}
open
override
func
layoutSubviews
()
{
open
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
super
.
layoutSubviews
()
layoutShape
()
layoutShadowPath
()
layoutShadowPath
()
if
let
v
=
topItem
{
if
let
v
=
topItem
{
...
...
Sources/iOS/NavigationController.swift
View file @
0bea0f61
...
@@ -106,6 +106,11 @@ open class NavigationController: UINavigationController {
...
@@ -106,6 +106,11 @@ open class NavigationController: UINavigationController {
v
.
layoutNavigationItem
(
item
:
item
)
v
.
layoutNavigationItem
(
item
:
item
)
}
}
open
override
func
viewWillLayoutSubviews
()
{
super
.
viewWillLayoutSubviews
()
navigationBar
.
width
=
view
.
width
}
/**
/**
Prepares the view instance when intialized. When subclassing,
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepare method
it is recommended to override the prepare method
...
@@ -115,6 +120,7 @@ open class NavigationController: UINavigationController {
...
@@ -115,6 +120,7 @@ open class NavigationController: UINavigationController {
*/
*/
open
func
prepare
()
{
open
func
prepare
()
{
navigationBar
.
heightPreset
=
.
normal
navigationBar
.
heightPreset
=
.
normal
navigationBar
.
width
=
view
.
width
view
.
clipsToBounds
=
true
view
.
clipsToBounds
=
true
view
.
backgroundColor
=
.
white
view
.
backgroundColor
=
.
white
...
...
Sources/iOS/TableViewCell.swift
View file @
0bea0f61
...
@@ -101,15 +101,11 @@ open class TableViewCell: UITableViewCell, Pulseable {
...
@@ -101,15 +101,11 @@ open class TableViewCell: UITableViewCell, Pulseable {
prepare
()
prepare
()
}
}
open
override
func
layoutSublayers
(
of
layer
:
CALayer
)
{
super
.
layoutSublayers
(
of
:
layer
)
layoutShape
()
layoutVisualLayer
()
}
open
override
func
layoutSubviews
()
{
open
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
super
.
layoutSubviews
()
layoutShadowPath
()
layoutShape
()
layoutVisualLayer
()
layoutShadowPath
()
}
}
/**
/**
...
...
Sources/iOS/TextField.swift
View file @
0bea0f61
...
@@ -372,13 +372,15 @@ open class TextField: UITextField {
...
@@ -372,13 +372,15 @@ open class TextField: UITextField {
open
override
func
layoutSubviews
()
{
open
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
super
.
layoutSubviews
()
guard
willLayout
&&
!
isAnimating
else
{
return
}
layoutShape
()
reload
()
reload
()
}
}
open
override
func
layoutSublayers
(
of
layer
:
CALayer
)
{
super
.
layoutSublayers
(
of
:
layer
)
layoutShape
()
}
/**
/**
Prepares the view instance when intialized. When subclassing,
Prepares the view instance when intialized. When subclassing,
...
@@ -402,10 +404,6 @@ open class TextField: UITextField {
...
@@ -402,10 +404,6 @@ open class TextField: UITextField {
/// Ensures that the components are sized correctly.
/// Ensures that the components are sized correctly.
open
func
reload
()
{
open
func
reload
()
{
guard
willLayout
&&
!
isAnimating
else
{
return
}
layoutPlaceholderLabel
()
layoutPlaceholderLabel
()
layoutDetailLabel
()
layoutDetailLabel
()
layoutButton
(
button
:
clearIconButton
)
layoutButton
(
button
:
clearIconButton
)
...
...
Sources/iOS/TextView.swift
View file @
0bea0f61
...
@@ -149,15 +149,12 @@ open class TextView: UITextView {
...
@@ -149,15 +149,12 @@ open class TextView: UITextView {
removeNotificationHandlers
()
removeNotificationHandlers
()
}
}
open
override
func
layoutSublayers
(
of
layer
:
CALayer
)
{
super
.
layoutSublayers
(
of
:
layer
)
layoutShape
()
}
open
override
func
layoutSubviews
()
{
open
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
super
.
layoutSubviews
()
layoutShadowPath
()
layoutShape
()
placeholderLabel
?
.
preferredMaxLayoutWidth
=
textContainer
.
size
.
width
-
textContainer
.
lineFragmentPadding
*
2
layoutShadowPath
()
placeholderLabel
?
.
preferredMaxLayoutWidth
=
textContainer
.
size
.
width
-
textContainer
.
lineFragmentPadding
*
2
titleLabel
?
.
frame
.
size
.
width
=
bounds
.
width
titleLabel
?
.
frame
.
size
.
width
=
bounds
.
width
}
}
...
...
Sources/iOS/Toolbar.swift
View file @
0bea0f61
...
@@ -45,7 +45,7 @@ open class Toolbar: Bar {
...
@@ -45,7 +45,7 @@ open class Toolbar: Bar {
}
}
/// Title label.
/// Title label.
open
internal
(set)
lazy
var
titleLabel
=
UILabel
()
open
fileprivate
(
set
)
lazy
var
titleLabel
=
UILabel
()
/// A convenience property to set the detailLabel text.
/// A convenience property to set the detailLabel text.
open
var
detail
:
String
?
{
open
var
detail
:
String
?
{
...
@@ -59,7 +59,7 @@ open class Toolbar: Bar {
...
@@ -59,7 +59,7 @@ open class Toolbar: Bar {
}
}
/// Detail label.
/// Detail label.
open
internal
(set)
lazy
var
detailLabel
=
UILabel
()
open
fileprivate
(
set
)
lazy
var
detailLabel
=
UILabel
()
deinit
{
deinit
{
removeObserver
(
self
,
forKeyPath
:
"titleLabel.textAlignment"
)
removeObserver
(
self
,
forKeyPath
:
"titleLabel.textAlignment"
)
...
...
Sources/iOS/View.swift
View file @
0bea0f61
...
@@ -156,14 +156,10 @@ open class View: UIView {
...
@@ -156,14 +156,10 @@ open class View: UIView {
prepare
()
prepare
()
}
}
open
override
func
layoutSublayers
(
of
layer
:
CALayer
)
{
super
.
layoutSublayers
(
of
:
layer
)
layoutShape
()
layoutVisualLayer
()
}
open
override
func
layoutSubviews
()
{
open
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
super
.
layoutSubviews
()
layoutShape
()
layoutVisualLayer
()
layoutShadowPath
()
layoutShadowPath
()
}
}
...
...
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