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
8e4bfc89
Commit
8e4bfc89
authored
Aug 21, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: fix for Button convenience initializers and code style updates
parent
f3408e13
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
80 additions
and
62 deletions
+80
-62
Sources/iOS/BottomTabBar.swift
+1
-1
Sources/iOS/Button.swift
+27
-9
Sources/iOS/Capture.swift
+1
-1
Sources/iOS/Card.swift
+2
-2
Sources/iOS/CollectionReusableView.swift
+1
-1
Sources/iOS/CollectionView.swift
+1
-1
Sources/iOS/CollectionViewCell.swift
+1
-1
Sources/iOS/ControlView.swift
+6
-6
Sources/iOS/Depth.swift
+1
-1
Sources/iOS/EdgeInsets.swift
+1
-1
Sources/iOS/ImageCard.swift
+6
-6
Sources/iOS/Label.swift
+1
-1
Sources/iOS/MaterialTextLayer.swift
+1
-1
Sources/iOS/Menu.swift
+1
-1
Sources/iOS/NavigationBar.swift
+18
-18
Sources/iOS/SearchBar.swift
+1
-1
Sources/iOS/TabBar.swift
+1
-1
Sources/iOS/TableViewCell.swift
+1
-1
Sources/iOS/TextField.swift
+5
-5
Sources/iOS/TextView.swift
+2
-2
Sources/iOS/View.swift
+1
-1
No files found.
Sources/iOS/BottomTabBar.swift
View file @
8e4bfc89
...
@@ -63,7 +63,7 @@ open class BottomTabBar: UITabBar {
...
@@ -63,7 +63,7 @@ open class BottomTabBar: UITabBar {
/// A convenience initializer.
/// A convenience initializer.
public
convenience
init
()
{
public
convenience
init
()
{
self
.
init
(
frame
:
CGRect
.
zero
)
self
.
init
(
frame
:
.
zero
)
}
}
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
...
...
Sources/iOS/Button.swift
View file @
8e4bfc89
...
@@ -58,7 +58,7 @@ open class Button: UIButton {
...
@@ -58,7 +58,7 @@ open class Button: UIButton {
open
var
pulseColor
=
Color
.
grey
.
base
open
var
pulseColor
=
Color
.
grey
.
base
/// The type of PulseAnimation.
/// The type of PulseAnimation.
public
var
pulseAnimation
:
PulseAnimation
=
.
pointWithBacking
public
var
pulseAnimation
=
PulseAnimation
.
pointWithBacking
/// A property that accesses the backing layer's backgroundColor.
/// A property that accesses the backing layer's backgroundColor.
@IBInspectable
@IBInspectable
...
@@ -69,7 +69,7 @@ open class Button: UIButton {
...
@@ -69,7 +69,7 @@ open class Button: UIButton {
}
}
/// A preset property for updated contentEdgeInsets.
/// A preset property for updated contentEdgeInsets.
open
var
contentEdgeInsetsPreset
:
EdgeInsetsPreset
=
.
none
{
open
var
contentEdgeInsetsPreset
=
EdgeInsetsPreset
.
none
{
didSet
{
didSet
{
contentEdgeInsets
=
EdgeInsetsPresetToValue
(
preset
:
contentEdgeInsetsPreset
)
contentEdgeInsets
=
EdgeInsetsPresetToValue
(
preset
:
contentEdgeInsetsPreset
)
}
}
...
@@ -124,7 +124,7 @@ open class Button: UIButton {
...
@@ -124,7 +124,7 @@ open class Button: UIButton {
/// A convenience initializer.
/// A convenience initializer.
public
convenience
init
()
{
public
convenience
init
()
{
self
.
init
(
frame
:
CGRect
.
zero
)
self
.
init
(
frame
:
.
zero
)
}
}
/**
/**
...
@@ -133,7 +133,7 @@ open class Button: UIButton {
...
@@ -133,7 +133,7 @@ open class Button: UIButton {
*/
*/
public
convenience
init
(
image
:
UIImage
?)
{
public
convenience
init
(
image
:
UIImage
?)
{
self
.
init
()
self
.
init
()
self
.
image
=
image
prepareWith
(
image
:
image
,
tintColor
:
nil
)
}
}
/**
/**
...
@@ -143,8 +143,7 @@ open class Button: UIButton {
...
@@ -143,8 +143,7 @@ open class Button: UIButton {
*/
*/
public
convenience
init
(
image
:
UIImage
?,
tintColor
:
UIColor
?)
{
public
convenience
init
(
image
:
UIImage
?,
tintColor
:
UIColor
?)
{
self
.
init
()
self
.
init
()
self
.
image
=
image
prepareWith
(
image
:
image
,
tintColor
:
tintColor
)
self
.
tintColor
=
tintColor
}
}
/**
/**
...
@@ -153,7 +152,7 @@ open class Button: UIButton {
...
@@ -153,7 +152,7 @@ open class Button: UIButton {
*/
*/
public
convenience
init
(
title
:
String
?)
{
public
convenience
init
(
title
:
String
?)
{
self
.
init
()
self
.
init
()
self
.
title
=
title
prepareWith
(
title
:
title
,
titleColor
:
nil
)
}
}
/**
/**
...
@@ -163,8 +162,7 @@ open class Button: UIButton {
...
@@ -163,8 +162,7 @@ open class Button: UIButton {
*/
*/
public
convenience
init
(
title
:
String
?,
titleColor
:
UIColor
?)
{
public
convenience
init
(
title
:
String
?,
titleColor
:
UIColor
?)
{
self
.
init
()
self
.
init
()
self
.
title
=
title
prepareWith
(
title
:
title
,
titleColor
:
titleColor
)
self
.
titleColor
=
titleColor
}
}
open
override
func
layoutSublayers
(
of
layer
:
CALayer
)
{
open
override
func
layoutSublayers
(
of
layer
:
CALayer
)
{
...
@@ -255,4 +253,24 @@ open class Button: UIButton {
...
@@ -255,4 +253,24 @@ open class Button: UIButton {
visualLayer
.
frame
=
bounds
visualLayer
.
frame
=
bounds
visualLayer
.
cornerRadius
=
cornerRadius
visualLayer
.
cornerRadius
=
cornerRadius
}
}
/**
Prepares the Button with an image and tintColor.
- Parameter image: A UIImage.
- Parameter tintColor: A UIColor.
*/
private
func
prepareWith
(
image
:
UIImage
?,
tintColor
:
UIColor
?)
{
self
.
image
=
image
self
.
tintColor
=
tintColor
}
/**
Prepares the Button with a title and titleColor.
- Parameter title: A String.
- Parameter titleColor: A UIColor.
*/
private
func
prepareWith
(
title
:
String
?,
titleColor
:
UIColor
?)
{
self
.
title
=
title
self
.
titleColor
=
titleColor
}
}
}
Sources/iOS/Capture.swift
View file @
8e4bfc89
...
@@ -283,7 +283,7 @@ open class Capture: View, UIGestureRecognizerDelegate {
...
@@ -283,7 +283,7 @@ open class Capture: View, UIGestureRecognizerDelegate {
/// A convenience initializer.
/// A convenience initializer.
public
convenience
init
()
{
public
convenience
init
()
{
self
.
init
(
frame
:
CGRect
.
zero
)
self
.
init
(
frame
:
.
zero
)
}
}
open
override
func
layoutSubviews
()
{
open
override
func
layoutSubviews
()
{
...
...
Sources/iOS/Card.swift
View file @
8e4bfc89
...
@@ -225,14 +225,14 @@ open class Card: PulseView {
...
@@ -225,14 +225,14 @@ open class Card: PulseView {
:name: init
:name: init
*/
*/
public
convenience
init
()
{
public
convenience
init
()
{
self
.
init
(
frame
:
CGRect
.
zero
)
self
.
init
(
frame
:
.
zero
)
}
}
/**
/**
:name: init
:name: init
*/
*/
public
convenience
init
?(
image
:
UIImage
?
=
nil
,
titleLabel
:
UILabel
?
=
nil
,
contentView
:
UIView
?
=
nil
,
leftButtons
:
[
UIButton
]?
=
nil
,
rightButtons
:
[
UIButton
]?
=
nil
)
{
public
convenience
init
?(
image
:
UIImage
?
=
nil
,
titleLabel
:
UILabel
?
=
nil
,
contentView
:
UIView
?
=
nil
,
leftButtons
:
[
UIButton
]?
=
nil
,
rightButtons
:
[
UIButton
]?
=
nil
)
{
self
.
init
(
frame
:
CGRect
.
zero
)
self
.
init
(
frame
:
.
zero
)
prepareProperties
(
image
:
image
,
titleLabel
:
titleLabel
,
contentView
:
contentView
,
leftButtons
:
leftButtons
,
rightButtons
:
rightButtons
)
prepareProperties
(
image
:
image
,
titleLabel
:
titleLabel
,
contentView
:
contentView
,
leftButtons
:
leftButtons
,
rightButtons
:
rightButtons
)
}
}
...
...
Sources/iOS/CollectionReusableView.swift
View file @
8e4bfc89
...
@@ -194,7 +194,7 @@ open class MaterialCollectionReusableView: UICollectionReusableView {
...
@@ -194,7 +194,7 @@ open class MaterialCollectionReusableView: UICollectionReusableView {
/// A convenience initializer.
/// A convenience initializer.
public
convenience
init
()
{
public
convenience
init
()
{
self
.
init
(
frame
:
CGRect
.
zero
)
self
.
init
(
frame
:
.
zero
)
}
}
open
override
func
layoutSublayers
(
of
layer
:
CALayer
)
{
open
override
func
layoutSublayers
(
of
layer
:
CALayer
)
{
...
...
Sources/iOS/CollectionView.swift
View file @
8e4bfc89
...
@@ -108,7 +108,7 @@ open class CollectionView: UICollectionView {
...
@@ -108,7 +108,7 @@ open class CollectionView: UICollectionView {
/// A convenience initializer that initializes the object.
/// A convenience initializer that initializes the object.
public
convenience
init
()
{
public
convenience
init
()
{
self
.
init
(
frame
:
CGRect
.
zero
)
self
.
init
(
frame
:
.
zero
)
}
}
/**
/**
...
...
Sources/iOS/CollectionViewCell.swift
View file @
8e4bfc89
...
@@ -204,7 +204,7 @@ open class CollectionViewCell: UICollectionViewCell {
...
@@ -204,7 +204,7 @@ open class CollectionViewCell: UICollectionViewCell {
/// A convenience initializer.
/// A convenience initializer.
public
convenience
init
()
{
public
convenience
init
()
{
self
.
init
(
frame
:
CGRect
.
zero
)
self
.
init
(
frame
:
.
zero
)
}
}
open
override
func
layoutSublayers
(
of
layer
:
CALayer
)
{
open
override
func
layoutSublayers
(
of
layer
:
CALayer
)
{
...
...
Sources/iOS/ControlView.swift
View file @
8e4bfc89
...
@@ -144,7 +144,7 @@ open class ControlView: View {
...
@@ -144,7 +144,7 @@ open class ControlView: View {
public
init
()
{
public
init
()
{
leftControls
=
[]
leftControls
=
[]
rightControls
=
[]
rightControls
=
[]
super
.
init
(
frame
:
CGRect
.
zero
)
super
.
init
(
frame
:
.
zero
)
frame
.
size
=
intrinsicContentSize
frame
.
size
=
intrinsicContentSize
}
}
...
@@ -156,7 +156,7 @@ open class ControlView: View {
...
@@ -156,7 +156,7 @@ open class ControlView: View {
public
init
(
leftControls
:
[
UIView
]?
=
nil
,
rightControls
:
[
UIView
]?
=
nil
)
{
public
init
(
leftControls
:
[
UIView
]?
=
nil
,
rightControls
:
[
UIView
]?
=
nil
)
{
self
.
leftControls
=
leftControls
??
[]
self
.
leftControls
=
leftControls
??
[]
self
.
rightControls
=
rightControls
??
[]
self
.
rightControls
=
rightControls
??
[]
super
.
init
(
frame
:
CGRect
.
zero
)
super
.
init
(
frame
:
.
zero
)
frame
.
size
=
intrinsicContentSize
frame
.
size
=
intrinsicContentSize
}
}
...
@@ -176,8 +176,8 @@ open class ControlView: View {
...
@@ -176,8 +176,8 @@ open class ControlView: View {
// leftControls
// leftControls
for
c
in
leftControls
{
for
c
in
leftControls
{
let
w
:
CGFloat
=
c
.
intrinsicContentSize
.
width
let
w
:
CGFloat
=
c
.
intrinsicContentSize
.
width
(
c
as?
UIButton
)?
.
contentEdgeInsets
=
UIEdgeInsets
.
zero
(
c
as?
UIButton
)?
.
contentEdgeInsets
=
.
zero
c
.
frame
.
size
.
height
=
frame
.
size
.
height
-
contentInset
.
top
-
contentInset
.
bottom
c
.
height
=
frame
.
size
.
height
-
contentInset
.
top
-
contentInset
.
bottom
let
q
:
Int
=
Int
(
w
/
gridFactor
)
let
q
:
Int
=
Int
(
w
/
gridFactor
)
c
.
grid
.
columns
=
q
+
1
c
.
grid
.
columns
=
q
+
1
...
@@ -194,8 +194,8 @@ open class ControlView: View {
...
@@ -194,8 +194,8 @@ open class ControlView: View {
// rightControls
// rightControls
for
c
in
rightControls
{
for
c
in
rightControls
{
let
w
=
c
.
intrinsicContentSize
.
width
let
w
=
c
.
intrinsicContentSize
.
width
(
c
as?
UIButton
)?
.
contentEdgeInsets
=
UIEdgeInsets
.
zero
(
c
as?
UIButton
)?
.
contentEdgeInsets
=
.
zero
c
.
frame
.
size
.
height
=
frame
.
size
.
height
-
contentInset
.
top
-
contentInset
.
bottom
c
.
height
=
frame
.
size
.
height
-
contentInset
.
top
-
contentInset
.
bottom
let
q
:
Int
=
Int
(
w
/
gridFactor
)
let
q
:
Int
=
Int
(
w
/
gridFactor
)
c
.
grid
.
columns
=
q
+
1
c
.
grid
.
columns
=
q
+
1
...
...
Sources/iOS/Depth.swift
View file @
8e4bfc89
...
@@ -94,7 +94,7 @@ public struct Depth {
...
@@ -94,7 +94,7 @@ public struct Depth {
public
func
DepthPresetToValue
(
preset
:
DepthPreset
)
->
Depth
{
public
func
DepthPresetToValue
(
preset
:
DepthPreset
)
->
Depth
{
switch
preset
{
switch
preset
{
case
.
none
:
case
.
none
:
return
Depth
.
zero
return
.
zero
case
.
depth1
:
case
.
depth1
:
return
Depth
(
offset
:
Offset
(
horizontal
:
0
,
vertical
:
1
),
opacity
:
0.3
,
radius
:
1
)
return
Depth
(
offset
:
Offset
(
horizontal
:
0
,
vertical
:
1
),
opacity
:
0.3
,
radius
:
1
)
case
.
depth2
:
case
.
depth2
:
...
...
Sources/iOS/EdgeInsets.swift
View file @
8e4bfc89
...
@@ -74,7 +74,7 @@ public typealias EdgeInsets = UIEdgeInsets
...
@@ -74,7 +74,7 @@ public typealias EdgeInsets = UIEdgeInsets
public
func
EdgeInsetsPresetToValue
(
preset
:
EdgeInsetsPreset
)
->
EdgeInsets
{
public
func
EdgeInsetsPresetToValue
(
preset
:
EdgeInsetsPreset
)
->
EdgeInsets
{
switch
preset
{
switch
preset
{
case
.
none
:
case
.
none
:
return
EdgeInsets
.
zero
return
.
zero
// square
// square
case
.
square1
:
case
.
square1
:
...
...
Sources/iOS/ImageCard.swift
View file @
8e4bfc89
...
@@ -93,15 +93,15 @@ open class ImageCard: PulseView {
...
@@ -93,15 +93,15 @@ open class ImageCard: PulseView {
prepareImageLayer
()
prepareImageLayer
()
imageLayer
?
.
contents
=
v
.
cgImage
imageLayer
?
.
contents
=
v
.
cgImage
if
0
==
maxImageHeight
{
if
0
==
maxImageHeight
{
imageLayer
?
.
frame
.
size
.
height
=
image
!.
size
.
height
/
contentsScale
imageLayer
?
.
height
=
image
!
.
height
/
contentsScale
}
else
{
}
else
{
let
h
:
CGFloat
=
image
!.
size
.
height
/
contentsScale
let
h
:
CGFloat
=
image
!.
height
/
contentsScale
imageLayer
?
.
frame
.
size
.
height
=
maxImageHeight
<
h
?
maxImageHeight
:
h
imageLayer
?
.
height
=
maxImageHeight
<
h
?
maxImageHeight
:
h
}
}
imageLayer
?
.
isHidden
=
false
imageLayer
?
.
isHidden
=
false
}
else
{
}
else
{
imageLayer
?
.
contents
=
nil
imageLayer
?
.
contents
=
nil
imageLayer
?
.
frame
=
CGRect
.
zero
imageLayer
?
.
frame
=
.
zero
imageLayer
?
.
isHidden
=
true
imageLayer
?
.
isHidden
=
true
imageLayer
?
.
removeFromSuperlayer
()
imageLayer
?
.
removeFromSuperlayer
()
}
}
...
@@ -325,14 +325,14 @@ open class ImageCard: PulseView {
...
@@ -325,14 +325,14 @@ open class ImageCard: PulseView {
:name: init
:name: init
*/
*/
public
convenience
init
()
{
public
convenience
init
()
{
self
.
init
(
frame
:
CGRect
.
zero
)
self
.
init
(
frame
:
.
zero
)
}
}
/**
/**
:name: init
:name: init
*/
*/
public
convenience
init
?(
image
:
UIImage
?
=
nil
,
titleLabel
:
UILabel
?
=
nil
,
contentView
:
UIView
?
=
nil
,
leftButtons
:
[
UIButton
]?
=
nil
,
rightButtons
:
[
UIButton
]?
=
nil
)
{
public
convenience
init
?(
image
:
UIImage
?
=
nil
,
titleLabel
:
UILabel
?
=
nil
,
contentView
:
UIView
?
=
nil
,
leftButtons
:
[
UIButton
]?
=
nil
,
rightButtons
:
[
UIButton
]?
=
nil
)
{
self
.
init
(
frame
:
CGRect
.
zero
)
self
.
init
(
frame
:
.
zero
)
prepareProperties
(
image
:
image
,
titleLabel
:
titleLabel
,
contentView
:
contentView
,
leftButtons
:
leftButtons
,
rightButtons
:
rightButtons
)
prepareProperties
(
image
:
image
,
titleLabel
:
titleLabel
,
contentView
:
contentView
,
leftButtons
:
leftButtons
,
rightButtons
:
rightButtons
)
}
}
...
...
Sources/iOS/Label.swift
View file @
8e4bfc89
...
@@ -137,7 +137,7 @@ open class Label: UILabel {
...
@@ -137,7 +137,7 @@ open class Label: UILabel {
:name: init
:name: init
*/
*/
public
convenience
init
()
{
public
convenience
init
()
{
self
.
init
(
frame
:
CGRect
.
zero
)
self
.
init
(
frame
:
.
zero
)
}
}
/**
/**
...
...
Sources/iOS/MaterialTextLayer.swift
View file @
8e4bfc89
...
@@ -149,7 +149,7 @@ public class MaterialTextLayer: CATextLayer {
...
@@ -149,7 +149,7 @@ public class MaterialTextLayer: CATextLayer {
*/
*/
public
func
stringSize
(
constrainedToWidth
width
:
Double
)
->
CGSize
{
public
func
stringSize
(
constrainedToWidth
width
:
Double
)
->
CGSize
{
guard
let
v
=
fontType
,
let
t
=
text
,
0
<
t
.
utf16
.
count
else
{
guard
let
v
=
fontType
,
let
t
=
text
,
0
<
t
.
utf16
.
count
else
{
return
CGSize
.
zero
return
.
zero
}
}
return
v
.
stringSize
(
string
:
text
!
,
constrainedToWidth
:
width
)
return
v
.
stringSize
(
string
:
text
!
,
constrainedToWidth
:
width
)
}
}
...
...
Sources/iOS/Menu.swift
View file @
8e4bfc89
...
@@ -98,7 +98,7 @@ public class Menu {
...
@@ -98,7 +98,7 @@ public class Menu {
/// Convenience initializer.
/// Convenience initializer.
public
convenience
init
()
{
public
convenience
init
()
{
self
.
init
(
origin
:
CGPoint
.
zero
)
self
.
init
(
origin
:
.
zero
)
}
}
/// Reload the view layout.
/// Reload the view layout.
...
...
Sources/iOS/NavigationBar.swift
View file @
8e4bfc89
...
@@ -33,9 +33,9 @@ import UIKit
...
@@ -33,9 +33,9 @@ import UIKit
/// NavigationBar styles.
/// NavigationBar styles.
@objc(NavigationBarStyle)
@objc(NavigationBarStyle)
public
enum
NavigationBarStyle
:
Int
{
public
enum
NavigationBarStyle
:
Int
{
case
Tiny
case
small
case
Default
case
medium
case
Medium
case
large
}
}
extension
UINavigationBar
{
extension
UINavigationBar
{
...
@@ -54,17 +54,17 @@ extension UINavigationBar {
...
@@ -54,17 +54,17 @@ extension UINavigationBar {
public
class
NavigationBar
:
UINavigationBar
{
public
class
NavigationBar
:
UINavigationBar
{
public
override
var
intrinsicContentSize
:
CGSize
{
public
override
var
intrinsicContentSize
:
CGSize
{
switch
navigationBarStyle
{
switch
navigationBarStyle
{
case
.
Tiny
:
case
.
small
:
return
CGSize
(
width
:
Device
.
width
,
height
:
32
)
return
CGSize
(
width
:
Device
.
width
,
height
:
32
)
case
.
Default
:
case
.
medium
:
return
CGSize
(
width
:
Device
.
width
,
height
:
44
)
return
CGSize
(
width
:
Device
.
width
,
height
:
44
)
case
.
Medium
:
case
.
large
:
return
CGSize
(
width
:
Device
.
width
,
height
:
56
)
return
CGSize
(
width
:
Device
.
width
,
height
:
56
)
}
}
}
}
/// NavigationBarStyle value.
/// NavigationBarStyle value.
public
var
navigationBarStyle
:
NavigationBarStyle
=
.
Default
public
var
navigationBarStyle
=
NavigationBarStyle
.
medium
internal
var
animating
:
Bool
=
false
internal
var
animating
:
Bool
=
false
...
@@ -74,21 +74,21 @@ public class NavigationBar: UINavigationBar {
...
@@ -74,21 +74,21 @@ public class NavigationBar: UINavigationBar {
}
}
/// A preset wrapper around contentInset.
/// A preset wrapper around contentInset.
public
var
contentEdgeInsetsPreset
:
EdgeInsetsPreset
=
.
none
{
public
var
contentEdgeInsetsPreset
=
EdgeInsetsPreset
.
none
{
didSet
{
didSet
{
contentInset
=
EdgeInsetsPresetToValue
(
preset
:
contentEdgeInsetsPreset
)
contentInset
=
EdgeInsetsPresetToValue
(
preset
:
contentEdgeInsetsPreset
)
}
}
}
}
/// A wrapper around grid.contentInset.
/// A wrapper around grid.contentInset.
@IBInspectable
public
var
contentInset
:
EdgeInsets
=
EdgeInsets
.
zero
{
@IBInspectable
public
var
contentInset
=
EdgeInsets
.
zero
{
didSet
{
didSet
{
layoutSubviews
()
layoutSubviews
()
}
}
}
}
/// A preset wrapper around interimSpace.
/// A preset wrapper around interimSpace.
public
var
interimSpacePreset
:
InterimSpacePreset
=
.
none
{
public
var
interimSpacePreset
=
InterimSpacePreset
.
none
{
didSet
{
didSet
{
interimSpace
=
InterimSpacePresetToValue
(
preset
:
interimSpacePreset
)
interimSpace
=
InterimSpacePresetToValue
(
preset
:
interimSpacePreset
)
}
}
...
@@ -153,7 +153,7 @@ public class NavigationBar: UINavigationBar {
...
@@ -153,7 +153,7 @@ public class NavigationBar: UINavigationBar {
/// A convenience initializer.
/// A convenience initializer.
public
convenience
init
()
{
public
convenience
init
()
{
self
.
init
(
frame
:
CGRect
.
zero
)
self
.
init
(
frame
:
.
zero
)
}
}
public
override
func
sizeThatFits
(
_
size
:
CGSize
)
->
CGSize
{
public
override
func
sizeThatFits
(
_
size
:
CGSize
)
->
CGSize
{
...
@@ -199,7 +199,7 @@ public class NavigationBar: UINavigationBar {
...
@@ -199,7 +199,7 @@ public class NavigationBar: UINavigationBar {
let
g
=
Int
(
width
/
gridFactor
)
let
g
=
Int
(
width
/
gridFactor
)
let
columns
=
g
+
1
let
columns
=
g
+
1
titleView
.
frame
.
origin
=
CGPoint
.
zero
titleView
.
frame
.
origin
=
.
zero
titleView
.
frame
.
size
=
intrinsicContentSize
titleView
.
frame
.
size
=
intrinsicContentSize
titleView
.
grid
.
views
=
[]
titleView
.
grid
.
views
=
[]
titleView
.
grid
.
axis
.
columns
=
columns
titleView
.
grid
.
axis
.
columns
=
columns
...
@@ -210,8 +210,8 @@ public class NavigationBar: UINavigationBar {
...
@@ -210,8 +210,8 @@ public class NavigationBar: UINavigationBar {
if
let
v
=
item
.
leftControls
{
if
let
v
=
item
.
leftControls
{
for
c
in
v
{
for
c
in
v
{
let
w
=
c
.
intrinsicContentSize
.
width
let
w
=
c
.
intrinsicContentSize
.
width
(
c
as?
UIButton
)?
.
contentEdgeInsets
=
UIEdgeInsets
.
zero
(
c
as?
UIButton
)?
.
contentEdgeInsets
=
.
zero
c
.
frame
.
size
.
height
=
titleView
.
frame
.
size
.
height
-
contentInset
.
top
-
contentInset
.
bottom
c
.
height
=
titleView
.
height
-
contentInset
.
top
-
contentInset
.
bottom
c
.
grid
.
columns
=
Int
(
w
/
gridFactor
)
+
1
c
.
grid
.
columns
=
Int
(
w
/
gridFactor
)
+
1
...
@@ -229,8 +229,8 @@ public class NavigationBar: UINavigationBar {
...
@@ -229,8 +229,8 @@ public class NavigationBar: UINavigationBar {
if
let
v
=
item
.
rightControls
{
if
let
v
=
item
.
rightControls
{
for
c
in
v
{
for
c
in
v
{
let
w
=
c
.
intrinsicContentSize
.
width
let
w
=
c
.
intrinsicContentSize
.
width
(
c
as?
UIButton
)?
.
contentEdgeInsets
=
UIEdgeInsets
.
zero
(
c
as?
UIButton
)?
.
contentEdgeInsets
=
.
zero
c
.
frame
.
size
.
height
=
titleView
.
frame
.
size
.
height
-
contentInset
.
top
-
contentInset
.
bottom
c
.
height
=
titleView
.
height
-
contentInset
.
top
-
contentInset
.
bottom
c
.
grid
.
columns
=
Int
(
w
/
gridFactor
)
+
1
c
.
grid
.
columns
=
Int
(
w
/
gridFactor
)
+
1
...
@@ -320,7 +320,7 @@ public class NavigationBar: UINavigationBar {
...
@@ -320,7 +320,7 @@ public class NavigationBar: UINavigationBar {
*/
*/
private
func
prepareTitleView
(
item
:
UINavigationItem
)
->
UIView
{
private
func
prepareTitleView
(
item
:
UINavigationItem
)
->
UIView
{
if
nil
==
item
.
titleView
{
if
nil
==
item
.
titleView
{
item
.
titleView
=
UIView
(
frame
:
CGRect
.
zero
)
item
.
titleView
=
UIView
(
frame
:
.
zero
)
}
}
return
item
.
titleView
!
return
item
.
titleView
!
}
}
...
@@ -332,7 +332,7 @@ public class NavigationBar: UINavigationBar {
...
@@ -332,7 +332,7 @@ public class NavigationBar: UINavigationBar {
*/
*/
private
func
prepareContentView
(
item
:
UINavigationItem
)
->
UIView
{
private
func
prepareContentView
(
item
:
UINavigationItem
)
->
UIView
{
if
nil
==
item
.
contentView
{
if
nil
==
item
.
contentView
{
item
.
contentView
=
UIView
(
frame
:
CGRect
.
zero
)
item
.
contentView
=
UIView
(
frame
:
.
zero
)
}
}
item
.
contentView
!.
grid
.
axis
.
direction
=
.
vertical
item
.
contentView
!.
grid
.
axis
.
direction
=
.
vertical
return
item
.
contentView
!
return
item
.
contentView
!
...
...
Sources/iOS/SearchBar.swift
View file @
8e4bfc89
...
@@ -160,7 +160,7 @@ public class SearchBar: BarView {
...
@@ -160,7 +160,7 @@ public class SearchBar: BarView {
/// Prepares the clearButton.
/// Prepares the clearButton.
private
func
prepareClearButton
()
{
private
func
prepareClearButton
()
{
clearButton
=
IconButton
(
image
:
Icon
.
cm
.
close
,
tintColor
:
placeholderColor
)
clearButton
=
IconButton
(
image
:
Icon
.
cm
.
close
,
tintColor
:
placeholderColor
)
clearButton
.
contentEdgeInsets
=
UIEdgeInsets
.
zero
clearButton
.
contentEdgeInsets
=
.
zero
clearButtonAutoHandleEnabled
=
true
clearButtonAutoHandleEnabled
=
true
textField
.
clearButtonMode
=
.
never
textField
.
clearButtonMode
=
.
never
textField
.
rightViewMode
=
.
whileEditing
textField
.
rightViewMode
=
.
whileEditing
...
...
Sources/iOS/TabBar.swift
View file @
8e4bfc89
...
@@ -121,7 +121,7 @@ open class TabBar: View {
...
@@ -121,7 +121,7 @@ open class TabBar: View {
let
columns
:
Int
=
grid
.
axis
.
columns
/
v
.
count
let
columns
:
Int
=
grid
.
axis
.
columns
/
v
.
count
for
b
in
v
{
for
b
in
v
{
b
.
grid
.
columns
=
columns
b
.
grid
.
columns
=
columns
b
.
contentEdgeInsets
=
UIEdgeInsets
.
zero
b
.
contentEdgeInsets
=
.
zero
b
.
layer
.
cornerRadius
=
0
b
.
layer
.
cornerRadius
=
0
b
.
removeTarget
(
self
,
action
:
#selector(
handleButton(button:)
)
,
for
:
.
touchUpInside
)
b
.
removeTarget
(
self
,
action
:
#selector(
handleButton(button:)
)
,
for
:
.
touchUpInside
)
b
.
addTarget
(
self
,
action
:
#selector(
handleButton(button:)
)
,
for
:
.
touchUpInside
)
b
.
addTarget
(
self
,
action
:
#selector(
handleButton(button:)
)
,
for
:
.
touchUpInside
)
...
...
Sources/iOS/TableViewCell.swift
View file @
8e4bfc89
...
@@ -155,7 +155,7 @@ open class TableViewCell: UITableViewCell {
...
@@ -155,7 +155,7 @@ open class TableViewCell: UITableViewCell {
*/
*/
open
func
prepareView
()
{
open
func
prepareView
()
{
selectionStyle
=
.
none
selectionStyle
=
.
none
separatorInset
=
UIEdgeInsets
.
zero
separatorInset
=
.
zero
contentScaleFactor
=
Device
.
scale
contentScaleFactor
=
Device
.
scale
imageView
?
.
isUserInteractionEnabled
=
false
imageView
?
.
isUserInteractionEnabled
=
false
textLabel
?
.
isUserInteractionEnabled
=
false
textLabel
?
.
isUserInteractionEnabled
=
false
...
...
Sources/iOS/TextField.swift
View file @
8e4bfc89
...
@@ -149,7 +149,7 @@ open class TextField: UITextField {
...
@@ -149,7 +149,7 @@ open class TextField: UITextField {
/// The detailLabel UILabel that is displayed.
/// The detailLabel UILabel that is displayed.
@IBInspectable
@IBInspectable
open
private(set)
lazy
var
detailLabel
=
UILabel
(
frame
:
CGRect
.
zero
)
open
private(set)
lazy
var
detailLabel
=
UILabel
(
frame
:
.
zero
)
/// The detailLabel text value.
/// The detailLabel text value.
...
@@ -207,7 +207,7 @@ open class TextField: UITextField {
...
@@ -207,7 +207,7 @@ open class TextField: UITextField {
if
value
{
if
value
{
if
nil
==
clearIconButton
{
if
nil
==
clearIconButton
{
clearIconButton
=
IconButton
(
image
:
Icon
.
cm
.
clear
,
tintColor
:
placeholderColor
)
clearIconButton
=
IconButton
(
image
:
Icon
.
cm
.
clear
,
tintColor
:
placeholderColor
)
clearIconButton
!.
contentEdgeInsets
=
UIEdgeInsets
.
zero
clearIconButton
!.
contentEdgeInsets
=
.
zero
clearIconButton
!.
pulseAnimation
=
.
center
clearIconButton
!.
pulseAnimation
=
.
center
clearButtonMode
=
.
never
clearButtonMode
=
.
never
rightViewMode
=
.
whileEditing
rightViewMode
=
.
whileEditing
...
@@ -242,7 +242,7 @@ open class TextField: UITextField {
...
@@ -242,7 +242,7 @@ open class TextField: UITextField {
if
value
{
if
value
{
if
nil
==
visibilityIconButton
{
if
nil
==
visibilityIconButton
{
visibilityIconButton
=
IconButton
(
image
:
Icon
.
visibility
,
tintColor
:
placeholderColor
.
withAlphaComponent
(
isSecureTextEntry
?
0.38
:
0.54
))
visibilityIconButton
=
IconButton
(
image
:
Icon
.
visibility
,
tintColor
:
placeholderColor
.
withAlphaComponent
(
isSecureTextEntry
?
0.38
:
0.54
))
visibilityIconButton
!.
contentEdgeInsets
=
UIEdgeInsets
.
zero
visibilityIconButton
!.
contentEdgeInsets
=
.
zero
visibilityIconButton
!.
pulseAnimation
=
.
center
visibilityIconButton
!.
pulseAnimation
=
.
center
isSecureTextEntry
=
true
isSecureTextEntry
=
true
clearButtonMode
=
.
never
clearButtonMode
=
.
never
...
@@ -296,7 +296,7 @@ open class TextField: UITextField {
...
@@ -296,7 +296,7 @@ open class TextField: UITextField {
/// A convenience initializer.
/// A convenience initializer.
public
convenience
init
()
{
public
convenience
init
()
{
self
.
init
(
frame
:
CGRect
.
zero
)
self
.
init
(
frame
:
.
zero
)
}
}
open
override
func
layoutSubviews
()
{
open
override
func
layoutSubviews
()
{
...
@@ -497,7 +497,7 @@ open class TextField: UITextField {
...
@@ -497,7 +497,7 @@ open class TextField: UITextField {
/// Prepares the placeholderLabel.
/// Prepares the placeholderLabel.
private
func
preparePlaceholderLabel
()
{
private
func
preparePlaceholderLabel
()
{
placeholderLabel
=
UILabel
(
frame
:
CGRect
.
zero
)
placeholderLabel
=
UILabel
(
frame
:
.
zero
)
placeholderColor
=
Color
.
darkText
.
others
placeholderColor
=
Color
.
darkText
.
others
font
=
RobotoFont
.
regularWithSize
(
size
:
16
)
font
=
RobotoFont
.
regularWithSize
(
size
:
16
)
addSubview
(
placeholderLabel
)
addSubview
(
placeholderLabel
)
...
...
Sources/iOS/TextView.swift
View file @
8e4bfc89
...
@@ -134,7 +134,7 @@ public class TextView: UITextView {
...
@@ -134,7 +134,7 @@ public class TextView: UITextView {
- Parameter textContainer: A NSTextContainer instance.
- Parameter textContainer: A NSTextContainer instance.
*/
*/
public
convenience
init
(
textContainer
:
NSTextContainer
?)
{
public
convenience
init
(
textContainer
:
NSTextContainer
?)
{
self
.
init
(
frame
:
CGRect
.
zero
,
textContainer
:
textContainer
)
self
.
init
(
frame
:
.
zero
,
textContainer
:
textContainer
)
}
}
/** Denitializer. This should never be called unless you know
/** Denitializer. This should never be called unless you know
...
@@ -218,7 +218,7 @@ public class TextView: UITextView {
...
@@ -218,7 +218,7 @@ public class TextView: UITextView {
*/
*/
public
func
prepareView
()
{
public
func
prepareView
()
{
contentScaleFactor
=
Device
.
scale
contentScaleFactor
=
Device
.
scale
textContainerInset
=
EdgeInsets
.
zero
textContainerInset
=
.
zero
backgroundColor
=
Color
.
white
backgroundColor
=
Color
.
white
clipsToBounds
=
false
clipsToBounds
=
false
removeNotificationHandlers
()
removeNotificationHandlers
()
...
...
Sources/iOS/View.swift
View file @
8e4bfc89
...
@@ -152,7 +152,7 @@ open class View: UIView {
...
@@ -152,7 +152,7 @@ open class View: UIView {
/// A convenience initializer.
/// A convenience initializer.
public
convenience
init
()
{
public
convenience
init
()
{
self
.
init
(
frame
:
CGRect
.
zero
)
self
.
init
(
frame
:
.
zero
)
}
}
open
override
func
layoutSublayers
(
of
layer
:
CALayer
)
{
open
override
func
layoutSublayers
(
of
layer
:
CALayer
)
{
...
...
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