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
ef355c28
Commit
ef355c28
authored
Sep 26, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing conflicted files
parent
6b0bd134
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
30 deletions
+60
-30
Sources/iOS/ChipBarController.swift
+12
-12
Sources/iOS/CollectionView.swift
+6
-2
Sources/iOS/Layer.swift
+18
-16
Sources/iOS/TextField.swift
+0
-0
Sources/iOS/Toolbar.swift
+24
-0
No files found.
Sources/iOS/ChipBarController.swift
View file @
ef355c28
...
@@ -45,7 +45,7 @@ extension UIViewController {
...
@@ -45,7 +45,7 @@ extension UIViewController {
This is the recommended method of accessing the ChipBarController
This is the recommended method of accessing the ChipBarController
through child UIViewControllers.
through child UIViewControllers.
*/
*/
public
var
chip
s
Controller
:
ChipBarController
?
{
public
var
chip
Bar
Controller
:
ChipBarController
?
{
return
traverseViewControllerHierarchyForClassType
()
return
traverseViewControllerHierarchyForClassType
()
}
}
}
}
...
@@ -61,25 +61,25 @@ open class ChipBarController: TransitionController {
...
@@ -61,25 +61,25 @@ open class ChipBarController: TransitionController {
layoutSubviews
()
layoutSubviews
()
}
}
}
}
/// The ChipBar used to switch between view controllers.
/// The ChipBar used to switch between view controllers.
@IBInspectable
@IBInspectable
open
let
chipBar
=
ChipBar
()
open
let
chipBar
=
ChipBar
()
/// The chipBar alignment.
/// The chipBar alignment.
open
var
chipBarAlignment
=
ChipBarAlignment
.
bottom
{
open
var
chipBarAlignment
=
ChipBarAlignment
.
bottom
{
didSet
{
didSet
{
layoutSubviews
()
layoutSubviews
()
}
}
}
}
open
override
func
layoutSubviews
()
{
open
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
super
.
layoutSubviews
()
layoutChipBar
()
layoutChipBar
()
layoutContainer
()
layoutContainer
()
layoutRootViewController
()
layoutRootViewController
()
}
}
open
override
func
prepare
()
{
open
override
func
prepare
()
{
super
.
prepare
()
super
.
prepare
()
prepareChipBar
()
prepareChipBar
()
...
@@ -98,12 +98,12 @@ fileprivate extension ChipBarController {
...
@@ -98,12 +98,12 @@ fileprivate extension ChipBarController {
/// Layout the container.
/// Layout the container.
func
layoutContainer
()
{
func
layoutContainer
()
{
chipBar
.
frame
.
size
.
width
=
view
.
bounds
.
width
chipBar
.
frame
.
size
.
width
=
view
.
bounds
.
width
switch
displayStyle
{
switch
displayStyle
{
case
.
partial
:
case
.
partial
:
let
p
=
chipBar
.
bounds
.
height
let
p
=
chipBar
.
bounds
.
height
let
y
=
view
.
bounds
.
height
-
p
let
y
=
view
.
bounds
.
height
-
p
switch
chipBarAlignment
{
switch
chipBarAlignment
{
case
.
top
:
case
.
top
:
container
.
frame
.
origin
.
y
=
p
container
.
frame
.
origin
.
y
=
p
...
@@ -115,18 +115,18 @@ fileprivate extension ChipBarController {
...
@@ -115,18 +115,18 @@ fileprivate extension ChipBarController {
container
.
frame
.
origin
.
y
=
0
container
.
frame
.
origin
.
y
=
0
container
.
frame
.
size
.
height
=
view
.
bounds
.
height
container
.
frame
.
size
.
height
=
view
.
bounds
.
height
}
}
container
.
frame
.
size
.
width
=
view
.
bounds
.
width
container
.
frame
.
size
.
width
=
view
.
bounds
.
width
case
.
full
:
case
.
full
:
container
.
frame
=
view
.
bounds
container
.
frame
=
view
.
bounds
}
}
}
}
/// Layout the chipBar.
/// Layout the chipBar.
func
layoutChipBar
()
{
func
layoutChipBar
()
{
chipBar
.
frame
.
size
.
width
=
view
.
bounds
.
width
chipBar
.
frame
.
size
.
width
=
view
.
bounds
.
width
switch
chipBarAlignment
{
switch
chipBarAlignment
{
case
.
top
:
case
.
top
:
chipBar
.
isHidden
=
false
chipBar
.
isHidden
=
false
...
@@ -138,7 +138,7 @@ fileprivate extension ChipBarController {
...
@@ -138,7 +138,7 @@ fileprivate extension ChipBarController {
chipBar
.
isHidden
=
true
chipBar
.
isHidden
=
true
}
}
}
}
/// Layout the rootViewController.
/// Layout the rootViewController.
func
layoutRootViewController
()
{
func
layoutRootViewController
()
{
rootViewController
.
view
.
frame
=
container
.
bounds
rootViewController
.
view
.
frame
=
container
.
bounds
...
...
Sources/iOS/CollectionView.swift
View file @
ef355c28
...
@@ -114,13 +114,17 @@ open class CollectionView: UICollectionView {
...
@@ -114,13 +114,17 @@ open class CollectionView: UICollectionView {
- Parameter frame: A CGRect defining the view's frame.
- Parameter frame: A CGRect defining the view's frame.
*/
*/
public
init
(
frame
:
CGRect
)
{
public
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
,
collectionViewLayout
:
CollectionViewLayout
())
let
layout
=
UICollectionViewFlowLayout
()
layout
.
itemSize
=
CGSize
(
width
:
100
,
height
:
100
)
super
.
init
(
frame
:
frame
,
collectionViewLayout
:
layout
)
prepare
()
prepare
()
}
}
/// A convenience initializer that initializes the object.
/// A convenience initializer that initializes the object.
public
init
()
{
public
init
()
{
super
.
init
(
frame
:
.
zero
,
collectionViewLayout
:
CollectionViewLayout
())
let
layout
=
UICollectionViewFlowLayout
()
layout
.
itemSize
=
CGSize
(
width
:
100
,
height
:
100
)
super
.
init
(
frame
:
.
zero
,
collectionViewLayout
:
layout
)
prepare
()
prepare
()
}
}
...
...
Sources/iOS/Layer.swift
View file @
ef355c28
...
@@ -39,7 +39,7 @@ open class Layer: CAShapeLayer {
...
@@ -39,7 +39,7 @@ open class Layer: CAShapeLayer {
the image to a desired shape within the visualLayer.
the image to a desired shape within the visualLayer.
*/
*/
open
let
visualLayer
=
CAShapeLayer
()
open
let
visualLayer
=
CAShapeLayer
()
/**
/**
A property that manages an image for the visualLayer's contents
A property that manages an image for the visualLayer's contents
property. Images should not be set to the backing layer's contents
property. Images should not be set to the backing layer's contents
...
@@ -51,7 +51,7 @@ open class Layer: CAShapeLayer {
...
@@ -51,7 +51,7 @@ open class Layer: CAShapeLayer {
visualLayer
.
contents
=
image
?
.
cgImage
visualLayer
.
contents
=
image
?
.
cgImage
}
}
}
}
/**
/**
Allows a relative subrectangle within the range of 0 to 1 to be
Allows a relative subrectangle within the range of 0 to 1 to be
specified for the visualLayer's contents property. This allows
specified for the visualLayer's contents property. This allows
...
@@ -63,7 +63,7 @@ open class Layer: CAShapeLayer {
...
@@ -63,7 +63,7 @@ open class Layer: CAShapeLayer {
visualLayer
.
contentsRect
=
contentsRect
visualLayer
.
contentsRect
=
contentsRect
}
}
}
}
/**
/**
A CGRect that defines a stretchable region inside the visualLayer
A CGRect that defines a stretchable region inside the visualLayer
with a fixed border around the edge.
with a fixed border around the edge.
...
@@ -73,7 +73,7 @@ open class Layer: CAShapeLayer {
...
@@ -73,7 +73,7 @@ open class Layer: CAShapeLayer {
visualLayer
.
contentsCenter
=
contentsCenter
visualLayer
.
contentsCenter
=
contentsCenter
}
}
}
}
/**
/**
A floating point value that defines a ratio between the pixel
A floating point value that defines a ratio between the pixel
dimensions of the visualLayer's contents property and the size
dimensions of the visualLayer's contents property and the size
...
@@ -85,14 +85,14 @@ open class Layer: CAShapeLayer {
...
@@ -85,14 +85,14 @@ open class Layer: CAShapeLayer {
visualLayer
.
contentsScale
=
contentsScale
visualLayer
.
contentsScale
=
contentsScale
}
}
}
}
/// A Preset for the contentsGravity property.
/// A Preset for the contentsGravity property.
open
var
contentsGravityPreset
:
Gravity
{
open
var
contentsGravityPreset
:
Gravity
{
didSet
{
didSet
{
contentsGravity
=
GravityToValue
(
gravity
:
contentsGravityPreset
)
contentsGravity
=
GravityToValue
(
gravity
:
contentsGravityPreset
)
}
}
}
}
/// Determines how content should be aligned within the visualLayer's bounds.
/// Determines how content should be aligned within the visualLayer's bounds.
@IBInspectable
@IBInspectable
open
override
var
contentsGravity
:
String
{
open
override
var
contentsGravity
:
String
{
...
@@ -103,7 +103,7 @@ open class Layer: CAShapeLayer {
...
@@ -103,7 +103,7 @@ open class Layer: CAShapeLayer {
visualLayer
.
contentsGravity
=
value
visualLayer
.
contentsGravity
=
value
}
}
}
}
/**
/**
A property that sets the cornerRadius of the backing layer. If the shape
A property that sets the cornerRadius of the backing layer. If the shape
property has a value of .circle when the cornerRadius is set, it will
property has a value of .circle when the cornerRadius is set, it will
...
@@ -116,7 +116,7 @@ open class Layer: CAShapeLayer {
...
@@ -116,7 +116,7 @@ open class Layer: CAShapeLayer {
shapePreset
=
.
none
shapePreset
=
.
none
}
}
}
}
/**
/**
An initializer that initializes the object with a NSCoder object.
An initializer that initializes the object with a NSCoder object.
- Parameter aDecoder: A NSCoder instance.
- Parameter aDecoder: A NSCoder instance.
...
@@ -126,7 +126,7 @@ open class Layer: CAShapeLayer {
...
@@ -126,7 +126,7 @@ open class Layer: CAShapeLayer {
super
.
init
(
coder
:
aDecoder
)
super
.
init
(
coder
:
aDecoder
)
prepareVisualLayer
()
prepareVisualLayer
()
}
}
/**
/**
An initializer the same as init(). The layer parameter is ignored
An initializer the same as init(). The layer parameter is ignored
to avoid crashes on certain architectures.
to avoid crashes on certain architectures.
...
@@ -137,14 +137,14 @@ open class Layer: CAShapeLayer {
...
@@ -137,14 +137,14 @@ open class Layer: CAShapeLayer {
super
.
init
(
layer
:
layer
)
super
.
init
(
layer
:
layer
)
prepareVisualLayer
()
prepareVisualLayer
()
}
}
/// A convenience initializer.
/// A convenience initializer.
public
override
init
()
{
public
override
init
()
{
contentsGravityPreset
=
.
resizeAspectFill
contentsGravityPreset
=
.
resizeAspectFill
super
.
init
()
super
.
init
()
prepareVisualLayer
()
prepareVisualLayer
()
}
}
/**
/**
An initializer that initializes the object with a CGRect object.
An initializer that initializes the object with a CGRect object.
- Parameter frame: A CGRect instance.
- Parameter frame: A CGRect instance.
...
@@ -153,23 +153,25 @@ open class Layer: CAShapeLayer {
...
@@ -153,23 +153,25 @@ open class Layer: CAShapeLayer {
self
.
init
()
self
.
init
()
self
.
frame
=
frame
self
.
frame
=
frame
}
}
open
override
func
layoutSublayers
()
{
open
override
func
layoutSublayers
()
{
super
.
layoutSublayers
()
super
.
layoutSublayers
()
layoutShape
()
layoutShape
()
layoutVisualLayer
()
layoutVisualLayer
()
layoutShadowPath
()
layoutShadowPath
()
}
}
}
fileprivate
extension
Layer
{
/// Prepares the visualLayer property.
/// Prepares the visualLayer property.
open
func
prepareVisualLayer
()
{
func
prepareVisualLayer
()
{
visualLayer
.
zPosition
=
0
visualLayer
.
zPosition
=
0
visualLayer
.
masksToBounds
=
true
visualLayer
.
masksToBounds
=
true
addSublayer
(
visualLayer
)
addSublayer
(
visualLayer
)
}
}
/// Manages the layout for the visualLayer property.
/// Manages the layout for the visualLayer property.
internal
func
layoutVisualLayer
()
{
func
layoutVisualLayer
()
{
visualLayer
.
frame
=
bounds
visualLayer
.
frame
=
bounds
visualLayer
.
cornerRadius
=
cornerRadius
visualLayer
.
cornerRadius
=
cornerRadius
}
}
...
...
Sources/iOS/TextField.swift
View file @
ef355c28
This diff is collapsed.
Click to expand it.
Sources/iOS/Toolbar.swift
View file @
ef355c28
...
@@ -33,10 +33,34 @@ import UIKit
...
@@ -33,10 +33,34 @@ import UIKit
fileprivate
var
ToolbarContext
:
UInt8
=
0
fileprivate
var
ToolbarContext
:
UInt8
=
0
open
class
Toolbar
:
Bar
{
open
class
Toolbar
:
Bar
{
/// A convenience property to set the titleLabel.text.
@IBInspectable
open
var
title
:
String
?
{
get
{
return
titleLabel
.
text
}
set
(
value
)
{
titleLabel
.
text
=
value
layoutSubviews
()
}
}
/// Title label.
/// Title label.
@IBInspectable
@IBInspectable
open
let
titleLabel
=
UILabel
()
open
let
titleLabel
=
UILabel
()
/// A convenience property to set the detailLabel.text.
@IBInspectable
open
var
detail
:
String
?
{
get
{
return
detailLabel
.
text
}
set
(
value
)
{
detailLabel
.
text
=
value
layoutSubviews
()
}
}
/// Detail label.
/// Detail label.
@IBInspectable
@IBInspectable
open
let
detailLabel
=
UILabel
()
open
let
detailLabel
=
UILabel
()
...
...
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