Commit 6f688295 by Daniel Dahan

Merge branch 'development' into editor

parents 689434d3 d8ec48b9
Pod::Spec.new do |s|
s.name = 'Material'
s.version = '2.3.2'
s.version = '2.3.4'
s.license = 'BSD-3-Clause'
s.summary = 'Material is an animation and graphics framework that is used to create beautiful applications.'
s.homepage = 'http://materialswift.com'
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.3.2</string>
<string>2.3.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
......@@ -35,8 +35,8 @@ open class ErrorTextField: TextField {
@IBInspectable
open var isErrorRevealed = false {
didSet {
layoutDetailLabel()
detailLabel.isHidden = !isErrorRevealed
layoutSubviews()
}
}
......
......@@ -37,70 +37,40 @@ public enum GridAxisDirection: Int {
case vertical
}
public class GridAxis {
/// Grid reference.
unowned var grid: Grid
public struct GridAxis {
/// The direction the grid lays its views out.
open var direction: GridAxisDirection = .horizontal {
didSet {
grid.reload()
}
}
var direction = GridAxisDirection.horizontal
/// The rows size.
public var rows: Int {
didSet {
grid.reload()
}
}
public var rows: Int
/// The columns size.
public var columns: Int {
didSet {
grid.reload()
}
}
public var columns: Int
/**
Initializer.
- Parameter grid: The Grid reference used for offset values.
- Parameter rows: The number of rows, vertical axis the grid will use.
- Parameter columns: The number of columns, horizontal axis the grid will use.
*/
public init(grid: Grid, rows: Int = 12, columns: Int = 12) {
self.grid = grid
public init(rows: Int = 12, columns: Int = 12) {
self.rows = rows
self.columns = columns
}
}
public class GridOffset {
/// Grid reference.
unowned var grid: Grid
public struct GridOffset {
/// The rows size.
public var rows: Int {
didSet {
grid.reload()
}
}
public var rows: Int
/// The columns size.
public var columns: Int {
didSet {
grid.reload()
}
}
public var columns: Int
/**
Initializer.
- Parameter grid: The Grid reference used for offset values.
- Parameter rows: The number of rows, vertical axis the grid will use.
- Parameter columns: The number of columns, horizontal axis the grid will use.
*/
public init(grid: Grid, rows: Int = 0, columns: Int = 0) {
self.grid = grid
public init(rows: Int = 0, columns: Int = 0) {
self.rows = rows
self.columns = columns
}
......@@ -128,10 +98,18 @@ public class Grid {
}
/// Offsets for rows and columns.
public private(set) var offset: GridOffset!
public var offset = GridOffset() {
didSet {
reload()
}
}
/// The axis in which the Grid is laying out its views.
public private(set) var axis: GridAxis!
public var axis = GridAxis() {
didSet {
reload()
}
}
/// Preset inset value for grid.
public var layoutEdgeInsetsPreset = EdgeInsetsPreset.none {
......@@ -178,6 +156,9 @@ public class Grid {
/// An Array of UIButtons.
public var views = [UIView]() {
didSet {
for v in oldValue {
v.removeFromSuperview()
}
reload()
}
}
......@@ -193,8 +174,6 @@ public class Grid {
self.rows = rows
self.columns = columns
self.interimSpace = interimSpace
offset = GridOffset(grid: self)
axis = GridAxis(grid: self)
}
/// Begins a deferred block.
......@@ -214,6 +193,14 @@ public class Grid {
return
}
guard let canvas = context else {
return
}
guard 0 < canvas.width && 0 < canvas.height else {
return
}
let count = views.count
guard 0 < count else {
......@@ -224,14 +211,6 @@ public class Grid {
var i = 0
for v in views {
guard let canvas = context else {
return
}
guard 0 < canvas.width && 0 < canvas.height else {
return
}
if canvas != v.superview {
v.removeFromSuperview()
canvas.addSubview(v)
......
......@@ -36,11 +36,11 @@
- Returns: The associated reference for the initializer object.
*/
internal func AssociatedObject<T: Any>(base: Any, key: UnsafePointer<UInt8>, initializer: () -> T) -> T {
if let v: T = objc_getAssociatedObject(base, key) as? T {
if let v = objc_getAssociatedObject(base, key) as? T {
return v
}
let v: T = initializer()
let v = initializer()
objc_setAssociatedObject(base, key, v, .OBJC_ASSOCIATION_RETAIN)
return v
}
......
......@@ -103,7 +103,7 @@ open class PageTabBarController: RootController {
/// Reference to the PageTabBar.
open private(set) lazy var pageTabBar: PageTabBar = PageTabBar()
/// A boolean that indicates whether bounds is enabled.
/// A boolean that indicates whether bounce is enabled.
open var isBounceEnabled: Bool {
didSet {
scrollView?.bounces = isBounceEnabled
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment