Commit ce5f66eb by Daniel Dahan

updated for Swift 4.2 and Motion 1.5.0

parent 6dc1048c
## 2.17.0
* Updated for Swift 4.2.
* Updated to [Motion 1.5.0](https://github.com/CosmicMind/Motion/releases/tag/1.5.0)
## 2.16.4
* [pr-1120](https://github.com/CosmicMind/Material/pull/1120): Fixed issue where TextField cursor was not being repositioned correctly.
......
Pod::Spec.new do |s|
s.name = 'Material'
s.version = '2.16.4'
s.version = '2.17.0'
s.swift_version = '4.0'
s.license = 'BSD-3-Clause'
s.summary = 'A UI/UX framework for creating beautiful applications.'
......
......@@ -55,7 +55,6 @@
965E80DB1DD4C50600D61E4B /* InterimSpace.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7871CB40DC500C806FE /* InterimSpace.swift */; };
965E80DC1DD4C50600D61E4B /* Depth.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7781CB40DC500C806FE /* Depth.swift */; };
965E80DD1DD4C50600D61E4B /* EdgeInsets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB77A1CB40DC500C806FE /* EdgeInsets.swift */; };
965E80DE1DD4C50600D61E4B /* Gravity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB77C1CB40DC500C806FE /* Gravity.swift */; };
965E80DF1DD4C50600D61E4B /* CornerRadius.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7851CB40DC500C806FE /* CornerRadius.swift */; };
965E80E01DD4C50600D61E4B /* Shape.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7861CB40DC500C806FE /* Shape.swift */; };
965E80E11DD4C50600D61E4B /* Offset.swift in Sources */ = {isa = PBXBuildFile; fileRef = 968C99461D377849000074FF /* Offset.swift */; };
......@@ -155,7 +154,6 @@
96BCB84E1CB4115200C806FE /* InterimSpace.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7871CB40DC500C806FE /* InterimSpace.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB84F1CB4115200C806FE /* Depth.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7781CB40DC500C806FE /* Depth.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8501CB4115200C806FE /* EdgeInsets.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB77A1CB40DC500C806FE /* EdgeInsets.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8511CB4115200C806FE /* Gravity.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB77C1CB40DC500C806FE /* Gravity.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8521CB4115200C806FE /* CornerRadius.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7851CB40DC500C806FE /* CornerRadius.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8531CB4115200C806FE /* Shape.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7861CB40DC500C806FE /* Shape.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8551CB4115200C806FE /* PulseView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7841CB40DC500C806FE /* PulseView.swift */; settings = {ATTRIBUTES = (Public, ); }; };
......@@ -254,7 +252,6 @@
96BCB7791CB40DC500C806FE /* Device.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Device.swift; sourceTree = "<group>"; };
96BCB77A1CB40DC500C806FE /* EdgeInsets.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EdgeInsets.swift; sourceTree = "<group>"; };
96BCB77B1CB40DC500C806FE /* Font.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Font.swift; sourceTree = "<group>"; };
96BCB77C1CB40DC500C806FE /* Gravity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Gravity.swift; sourceTree = "<group>"; };
96BCB77D1CB40DC500C806FE /* Icon.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Icon.swift; sourceTree = "<group>"; };
96BCB7801CB40DC500C806FE /* Layer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Layer.swift; sourceTree = "<group>"; };
96BCB7811CB40DC500C806FE /* Layout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Layout.swift; sourceTree = "<group>"; };
......@@ -666,7 +663,6 @@
96BCB7871CB40DC500C806FE /* InterimSpace.swift */,
96BCB7781CB40DC500C806FE /* Depth.swift */,
96BCB77A1CB40DC500C806FE /* EdgeInsets.swift */,
96BCB77C1CB40DC500C806FE /* Gravity.swift */,
96BCB7851CB40DC500C806FE /* CornerRadius.swift */,
96BCB7861CB40DC500C806FE /* Shape.swift */,
968C99461D377849000074FF /* Offset.swift */,
......@@ -814,7 +810,6 @@
96BCB84E1CB4115200C806FE /* InterimSpace.swift in Headers */,
96BCB84F1CB4115200C806FE /* Depth.swift in Headers */,
96BCB8501CB4115200C806FE /* EdgeInsets.swift in Headers */,
96BCB8511CB4115200C806FE /* Gravity.swift in Headers */,
96BCB8521CB4115200C806FE /* CornerRadius.swift in Headers */,
96BCB8531CB4115200C806FE /* Shape.swift in Headers */,
96BCB8551CB4115200C806FE /* PulseView.swift in Headers */,
......@@ -889,14 +884,14 @@
attributes = {
LastSwiftMigration = 0710;
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = "CosmicMind, Inc.";
TargetAttributes = {
963832351B88DFD80015F710 = {
CreatedOnToolsVersion = 6.4;
DevelopmentTeam = 9Z76XCNLGL;
DevelopmentTeamName = "CosmicMind Inc.";
LastSwiftMigration = 0900;
LastSwiftMigration = 1000;
ProvisioningStyle = Manual;
};
};
......@@ -1038,7 +1033,6 @@
965E80DC1DD4C50600D61E4B /* Depth.swift in Sources */,
965E80DD1DD4C50600D61E4B /* EdgeInsets.swift in Sources */,
9DF74C4E20D15D84003C1D66 /* Material+UIColor.swift in Sources */,
965E80DE1DD4C50600D61E4B /* Gravity.swift in Sources */,
965E80DF1DD4C50600D61E4B /* CornerRadius.swift in Sources */,
965E80FB1DD4D59500D61E4B /* SearchBar.swift in Sources */,
965E80E01DD4C50600D61E4B /* Shape.swift in Sources */,
......@@ -1200,8 +1194,7 @@
PROVISIONING_PROFILE = "";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
......@@ -1225,9 +1218,8 @@
PRODUCT_NAME = Material;
PROVISIONING_PROFILE = "";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 4.2;
};
name = Release;
};
......
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
......
Subproject commit 296684b3388ffca638662311521ee696f7b29247
Subproject commit 01326135e33f5f4d6d751a634d7463cf39864dbc
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.16.4</string>
<string>2.17.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
......@@ -105,7 +105,7 @@ open class Bar: View {
}
/// ContentView that holds the any desired subviews.
open let contentView = UIView()
public let contentView = UIView()
/// Left side UIViews.
open var leftViews = [UIView]() {
......
......@@ -36,7 +36,7 @@ open class BaseIconLayerButton: Button {
/// - Parameters:
/// - color: The color of the icon to use for the specified state.
/// - state: The state that uses the specified color. Supports only (.normal, .selected, .disabled)
open func setIconColor(_ color: UIColor, for state: UIControlState) {
open func setIconColor(_ color: UIColor, for state: UIControl.State) {
switch state {
case .normal:
iconLayer.normalColor = color
......@@ -53,7 +53,7 @@ open class BaseIconLayerButton: Button {
///
/// - Parameter state: The state that uses the icon color. Supports only (.normal, .selected, .disabled)
/// - Returns: The color of the title for the specified state.
open func iconColor(for state: UIControlState) -> UIColor {
open func iconColor(for state: UIControl.State) -> UIColor {
switch state {
case .normal:
return iconLayer.normalColor
......
......@@ -94,7 +94,7 @@ open class BottomNavigationController: UITabBarController {
if .phone == Device.userInterfaceIdiom {
if nil == item.title {
let inset: CGFloat = 7
item.imageInsets = UIEdgeInsetsMake(inset, 0, -inset, 0)
item.imageInsets = UIEdgeInsets.init(top: inset, left: 0, bottom: -inset, right: 0)
} else {
let inset: CGFloat = 6
item.titlePositionAdjustment.vertical = -inset
......@@ -102,10 +102,10 @@ open class BottomNavigationController: UITabBarController {
} else {
if nil == item.title {
let inset: CGFloat = 9
item.imageInsets = UIEdgeInsetsMake(inset, 0, -inset, 0)
item.imageInsets = UIEdgeInsets.init(top: inset, left: 0, bottom: -inset, right: 0)
} else {
let inset: CGFloat = 3
item.imageInsets = UIEdgeInsetsMake(inset, 0, -inset, 0)
item.imageInsets = UIEdgeInsets.init(top: inset, left: 0, bottom: -inset, right: 0)
item.titlePositionAdjustment.vertical = -inset
}
}
......
......@@ -38,7 +38,7 @@ open class Button: UIButton, Pulseable, PulseableLayer {
allows the dropshadow effect on the backing layer, while clipping
the image to a desired shape within the visualLayer.
*/
open let visualLayer = CAShapeLayer()
public let visualLayer = CAShapeLayer()
/// A Pulse reference.
internal var pulse: Pulse!
......@@ -267,7 +267,7 @@ open class Button: UIButton, Pulseable, PulseableLayer {
return
}
bringSubview(toFront: v)
bringSubviewToFront(v)
}
/**
......
......@@ -32,7 +32,7 @@ import UIKit
open class Card: PulseView {
/// A container view for subviews.
open let container = UIView()
public let container = UIView()
@IBInspectable
open override var cornerRadiusPreset: CornerRadiusPreset {
......
......@@ -43,7 +43,7 @@ extension UIViewController {
open class CardCollectionViewController: ViewController {
/// A reference to a Reminder.
open let collectionView = CollectionView()
public let collectionView = CollectionView()
open var dataSourceItems = [DataSourceItem]()
......
......@@ -74,8 +74,8 @@ internal class CheckBoxLayer: BaseIconLayer {
addSublayer(checkMarkLayer)
checkMarkLayer.addSublayer(checkMarkLeftLayer)
checkMarkLayer.addSublayer(checkMarkRightLayer)
checkMarkLeftLayer.lineCap = kCALineCapSquare
checkMarkRightLayer.lineCap = kCALineCapSquare
checkMarkLeftLayer.lineCap = CAShapeLayerLineCap.square
checkMarkRightLayer.lineCap = CAShapeLayerLineCap.square
checkMarkLeftLayer.strokeEnd = 0
checkMarkRightLayer.strokeEnd = 0
checkmarkColor = { checkmarkColor }() // calling didSet
......
......@@ -144,7 +144,7 @@ open class ChipBar: Bar {
}
/// A reference to the scroll view when the chip bar style is scrollable.
open let scrollView = UIScrollView()
public let scrollView = UIScrollView()
/// Enables and disables bouncing when swiping.
open var isScrollBounceEnabled: Bool {
......
......@@ -64,7 +64,7 @@ open class ChipBarController: TransitionController {
/// The ChipBar used to switch between view controllers.
@IBInspectable
open let chipBar = ChipBar()
public let chipBar = ChipBar()
/// The chipBar alignment.
open var chipBarAlignment = ChipBarAlignment.bottom {
......
......@@ -39,7 +39,7 @@ open class CollectionReusableView: UICollectionReusableView, Pulseable, Pulseabl
allows the dropshadow effect on the backing layer, while clipping
the image to a desired shape within the visualLayer.
*/
open let visualLayer = CAShapeLayer()
public let visualLayer = CAShapeLayer()
/// A Pulse reference.
internal var pulse: Pulse!
......@@ -138,16 +138,9 @@ open class CollectionReusableView: UICollectionReusableView, Pulseable, Pulseabl
}
}
/// A Preset for the contentsGravity property.
open var contentsGravityPreset: Gravity {
didSet {
contentsGravity = GravityToValue(gravity: contentsGravityPreset)
}
}
/// Determines how content should be aligned within the visualLayer's bounds.
@IBInspectable
open var contentsGravity: String {
open var contentsGravity: CALayerContentsGravity {
get {
return visualLayer.contentsGravity
}
......@@ -211,7 +204,6 @@ open class CollectionReusableView: UICollectionReusableView, Pulseable, Pulseabl
- Parameter aDecoder: A NSCoder instance.
*/
public required init?(coder aDecoder: NSCoder) {
contentsGravityPreset = .resizeAspectFill
super.init(coder: aDecoder)
prepare()
}
......@@ -223,7 +215,6 @@ open class CollectionReusableView: UICollectionReusableView, Pulseable, Pulseabl
- Parameter frame: A CGRect instance.
*/
public override init(frame: CGRect) {
contentsGravityPreset = .resizeAspectFill
super.init(frame: frame)
prepare()
}
......@@ -288,6 +279,7 @@ open class CollectionReusableView: UICollectionReusableView, Pulseable, Pulseabl
when subclassing.
*/
open func prepare() {
contentsGravity = .resizeAspectFill
contentScaleFactor = Screen.scale
prepareVisualLayer()
preparePulse()
......
......@@ -51,7 +51,7 @@ open class CollectionView: UICollectionView {
}
/// Scroll direction.
open var scrollDirection: UICollectionViewScrollDirection {
open var scrollDirection: UICollectionView.ScrollDirection {
get {
return (collectionViewLayout as? CollectionViewLayout)!.scrollDirection
}
......
......@@ -39,7 +39,7 @@ open class CollectionViewCell: UICollectionViewCell, Pulseable, PulseableLayer {
allows the dropshadow effect on the backing layer, while clipping
the image to a desired shape within the visualLayer.
*/
open let visualLayer = CAShapeLayer()
public let visualLayer = CAShapeLayer()
/// A Pulse reference.
internal var pulse: Pulse!
......@@ -138,16 +138,9 @@ open class CollectionViewCell: UICollectionViewCell, Pulseable, PulseableLayer {
}
}
/// A Preset for the contentsGravity property.
public var contentsGravityPreset: Gravity {
didSet {
contentsGravity = GravityToValue(gravity: contentsGravityPreset)
}
}
/// Determines how content should be aligned within the visualLayer's bounds.
@IBInspectable
open var contentsGravity: String {
open var contentsGravity: CALayerContentsGravity {
get {
return visualLayer.contentsGravity
}
......@@ -169,7 +162,6 @@ open class CollectionViewCell: UICollectionViewCell, Pulseable, PulseableLayer {
- Parameter aDecoder: A NSCoder instance.
*/
public required init?(coder aDecoder: NSCoder) {
contentsGravityPreset = .resizeAspectFill
super.init(coder: aDecoder)
prepare()
}
......@@ -181,7 +173,6 @@ open class CollectionViewCell: UICollectionViewCell, Pulseable, PulseableLayer {
- Parameter frame: A CGRect instance.
*/
public override init(frame: CGRect) {
contentsGravityPreset = .resizeAspectFill
super.init(frame: frame)
prepare()
}
......@@ -246,31 +237,32 @@ open class CollectionViewCell: UICollectionViewCell, Pulseable, PulseableLayer {
when subclassing.
*/
open func prepare() {
backgroundColor = .white
contentsGravity = .resizeAspectFill
contentScaleFactor = Screen.scale
backgroundColor = .white
prepareVisualLayer()
preparePulse()
}
}
extension CollectionViewCell {
fileprivate extension CollectionViewCell {
/// Prepares the pulse motion.
fileprivate func preparePulse() {
func preparePulse() {
pulse = Pulse(pulseView: self, pulseLayer: visualLayer)
}
/// Prepares the visualLayer property.
fileprivate func prepareVisualLayer() {
func prepareVisualLayer() {
visualLayer.zPosition = 0
visualLayer.masksToBounds = true
layer.addSublayer(visualLayer)
}
}
extension CollectionViewCell {
fileprivate extension CollectionViewCell {
/// Manages the layout for the visualLayer property.
fileprivate func layoutVisualLayer() {
func layoutVisualLayer() {
visualLayer.frame = bounds
visualLayer.cornerRadius = layer.cornerRadius
}
......
......@@ -53,7 +53,7 @@ extension UIViewController {
open class CollectionViewController: ViewController {
/// A reference to a Reminder.
open let collectionView = CollectionView()
public let collectionView = CollectionView()
open var dataSourceItems = [DataSourceItem]()
......
......@@ -57,7 +57,7 @@ open class CollectionViewLayout: UICollectionViewLayout {
public fileprivate(set) var dataSourceItems: [DataSourceItem]?
/// Scroll direction.
public var scrollDirection = UICollectionViewScrollDirection.vertical
public var scrollDirection = UICollectionView.ScrollDirection.vertical
/// A preset wrapper around interimSpace.
public var interimSpacePreset = InterimSpacePreset.none {
......
......@@ -63,6 +63,6 @@ open class DynamicFontType: NSObject {
/// Prepares observation for content size changes.
private func prepareContentSizeObservation() {
NotificationCenter.default.addObserver(self, selector: #selector(handleContentSizeChange), name: .UIContentSizeCategoryDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(handleContentSizeChange), name: UIContentSizeCategory.didChangeNotification, object: nil)
}
}
......@@ -34,7 +34,7 @@ open class ErrorTextField: TextField {
/// The errorLabel UILabel that is displayed.
@IBInspectable
open let errorLabel = UILabel()
public let errorLabel = UILabel()
/// The errorLabel text value.
@IBInspectable
......
......@@ -46,13 +46,13 @@ public enum FABMenuDirection: Int {
open class FABMenuItem: View {
/// A reference to the titleLabel.
open let titleLabel = UILabel()
public let titleLabel = UILabel()
/// The titleLabel side.
open var titleLabelPosition = FABMenuItemTitleLabelPosition.left
/// A reference to the fabButton.
open let fabButton = FABButton()
public let fabButton = FABButton()
open override func prepare() {
super.prepare()
......@@ -355,7 +355,7 @@ extension FABMenu {
- Parameter animations: An animation block to execute on each view's animation.
- Parameter completion: A completion block to execute on each view's animation.
*/
open func open(duration: TimeInterval = 0.15, delay: TimeInterval = 0, usingSpringWithDamping: CGFloat = 0.5, initialSpringVelocity: CGFloat = 0, options: UIViewAnimationOptions = [], animations: ((UIView) -> Void)? = nil, completion: ((UIView) -> Void)? = nil) {
open func open(duration: TimeInterval = 0.15, delay: TimeInterval = 0, usingSpringWithDamping: CGFloat = 0.5, initialSpringVelocity: CGFloat = 0, options: UIView.AnimationOptions = [], animations: ((UIView) -> Void)? = nil, completion: ((UIView) -> Void)? = nil) {
open(isTriggeredByUserInteraction: false, duration: duration, delay: delay, usingSpringWithDamping: usingSpringWithDamping, initialSpringVelocity: initialSpringVelocity, options: options, animations: animations, completion: completion)
}
......@@ -371,7 +371,7 @@ extension FABMenu {
- Parameter animations: An animation block to execute on each view's animation.
- Parameter completion: A completion block to execute on each view's animation.
*/
open func open(isTriggeredByUserInteraction: Bool, duration: TimeInterval = 0.15, delay: TimeInterval = 0, usingSpringWithDamping: CGFloat = 0.5, initialSpringVelocity: CGFloat = 0, options: UIViewAnimationOptions = [], animations: ((UIView) -> Void)? = nil, completion: ((UIView) -> Void)? = nil) {
open func open(isTriggeredByUserInteraction: Bool, duration: TimeInterval = 0.15, delay: TimeInterval = 0, usingSpringWithDamping: CGFloat = 0.5, initialSpringVelocity: CGFloat = 0, options: UIView.AnimationOptions = [], animations: ((UIView) -> Void)? = nil, completion: ((UIView) -> Void)? = nil) {
if isTriggeredByUserInteraction && false == delegate?.fabMenuShouldOpen?(fabMenu: self) {
return
......@@ -409,7 +409,7 @@ extension FABMenu {
- Parameter animations: An animation block to execute on each view's animation.
- Parameter completion: A completion block to execute on each view's animation.
*/
open func close(duration: TimeInterval = 0.15, delay: TimeInterval = 0, usingSpringWithDamping: CGFloat = 0.5, initialSpringVelocity: CGFloat = 0, options: UIViewAnimationOptions = [], animations: ((UIView) -> Void)? = nil, completion: ((UIView) -> Void)? = nil) {
open func close(duration: TimeInterval = 0.15, delay: TimeInterval = 0, usingSpringWithDamping: CGFloat = 0.5, initialSpringVelocity: CGFloat = 0, options: UIView.AnimationOptions = [], animations: ((UIView) -> Void)? = nil, completion: ((UIView) -> Void)? = nil) {
close(isTriggeredByUserInteraction: false, duration: duration, delay: delay, usingSpringWithDamping: usingSpringWithDamping, initialSpringVelocity: initialSpringVelocity, options: options, animations: animations, completion: completion)
}
......@@ -425,7 +425,7 @@ extension FABMenu {
- Parameter animations: An animation block to execute on each view's animation.
- Parameter completion: A completion block to execute on each view's animation.
*/
open func close(isTriggeredByUserInteraction: Bool, duration: TimeInterval = 0.15, delay: TimeInterval = 0, usingSpringWithDamping: CGFloat = 0.5, initialSpringVelocity: CGFloat = 0, options: UIViewAnimationOptions = [], animations: ((UIView) -> Void)? = nil, completion: ((UIView) -> Void)? = nil) {
open func close(isTriggeredByUserInteraction: Bool, duration: TimeInterval = 0.15, delay: TimeInterval = 0, usingSpringWithDamping: CGFloat = 0.5, initialSpringVelocity: CGFloat = 0, options: UIView.AnimationOptions = [], animations: ((UIView) -> Void)? = nil, completion: ((UIView) -> Void)? = nil) {
if isTriggeredByUserInteraction && false == delegate?.fabMenuShouldClose?(fabMenu: self) {
return
......
......@@ -56,7 +56,7 @@ open class FABMenuController: TransitionController {
open var fabMenuBacking = FABMenuBacking.blur
/// The fabMenuBacking UIBlurEffectStyle.
open var fabMenuBackingBlurEffectStyle = UIBlurEffectStyle.light
open var fabMenuBackingBlurEffectStyle = UIBlurEffect.Style.light
/// A reference to the blurView.
open fileprivate(set) var blurView: UIView?
......@@ -131,7 +131,7 @@ fileprivate extension FABMenuController {
blurView = UIView()
blurView?.layout(blur).edges()
view.layout(blurView!).edges()
view.bringSubview(toFront: fabMenu)
view.bringSubviewToFront(fabMenu)
}
/// Hides the blurView.
......
/*
* Copyright (C) 2015 - 2018, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.com>.
* 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
@objc(Gravity)
public enum Gravity: Int {
case center
case top
case bottom
case left
case right
case topLeft
case topRight
case bottomLeft
case bottomRight
case resize
case resizeAspect
case resizeAspectFill
}
/// Converts the Gravity enum to a String value.
public func GravityToValue(gravity: Gravity) -> String {
switch gravity {
case .center:
return kCAGravityCenter
case .top:
return kCAGravityTop
case .bottom:
return kCAGravityBottom
case .left:
return kCAGravityLeft
case .right:
return kCAGravityRight
case .topLeft:
return kCAGravityBottomLeft
case .topRight:
return kCAGravityBottomRight
case .bottomLeft:
return kCAGravityTopLeft
case .bottomRight:
return kCAGravityTopRight
case .resize:
return kCAGravityResize
case .resizeAspect:
return kCAGravityResizeAspect
case .resizeAspectFill:
return kCAGravityResizeAspectFill
}
}
......@@ -84,13 +84,13 @@ open class ImageCard: Card {
if let v = imageView {
h = prepare(view: v, with: imageViewEdgeInsets, from: h)
container.sendSubview(toBack: v)
container.sendSubviewToBack(v)
}
if let v = toolbar {
prepare(view: v, with: toolbarEdgeInsets, from: h)
v.frame.origin.y = .top == toolbarAlignment ? toolbarEdgeInsets.top : h - v.bounds.height - toolbarEdgeInsets.bottom
container.bringSubview(toFront: v)
container.bringSubviewToFront(v)
}
if let v = contentView {
......
......@@ -38,7 +38,7 @@ open class Layer: CAShapeLayer {
allows the dropshadow effect on the backing layer, while clipping
the image to a desired shape within the visualLayer.
*/
open let visualLayer = CAShapeLayer()
public let visualLayer = CAShapeLayer()
/**
A property that manages an image for the visualLayer's contents
......@@ -86,16 +86,9 @@ open class Layer: CAShapeLayer {
}
}
/// A Preset for the contentsGravity property.
open var contentsGravityPreset: Gravity {
didSet {
contentsGravity = GravityToValue(gravity: contentsGravityPreset)
}
}
/// Determines how content should be aligned within the visualLayer's bounds.
@IBInspectable
open override var contentsGravity: String {
open override var contentsGravity: CALayerContentsGravity {
get {
return visualLayer.contentsGravity
}
......@@ -122,7 +115,6 @@ open class Layer: CAShapeLayer {
- Parameter aDecoder: A NSCoder instance.
*/
public required init?(coder aDecoder: NSCoder) {
contentsGravityPreset = .resizeAspectFill
super.init(coder: aDecoder)
prepareVisualLayer()
}
......@@ -133,14 +125,12 @@ open class Layer: CAShapeLayer {
- Parameter layer: Any.
*/
public override init(layer: Any) {
contentsGravityPreset = .resizeAspectFill
super.init(layer: layer)
prepareVisualLayer()
}
/// A convenience initializer.
public override init() {
contentsGravityPreset = .resizeAspectFill
super.init()
prepareVisualLayer()
}
......@@ -165,6 +155,7 @@ open class Layer: CAShapeLayer {
fileprivate extension Layer {
/// Prepares the visualLayer property.
func prepareVisualLayer() {
contentsGravity = .resizeAspectFill
visualLayer.zPosition = 0
visualLayer.masksToBounds = true
addSublayer(visualLayer)
......
......@@ -930,7 +930,7 @@ extension Layout {
- Parameter views: A Dictionary<String, Any> of view key / value pairs.
- Returns: The Array<NSLayoutConstraint> instance.
*/
public class func constraint(format: String, options: NSLayoutFormatOptions, metrics: [String: Any]?, views: [String: Any]) -> [NSLayoutConstraint] {
public class func constraint(format: String, options: NSLayoutConstraint.FormatOptions, metrics: [String: Any]?, views: [String: Any]) -> [NSLayoutConstraint] {
for (_, a) in views {
if let v = a as? UIView {
v.translatesAutoresizingMaskIntoConstraints = false
......
......@@ -37,7 +37,7 @@ extension NSMutableAttributedString {
- Parameter value: Any type.
- Parameter range: A NSRange.
*/
open func updateAttribute(_ name: NSAttributedStringKey, value: Any, range: NSRange) {
open func updateAttribute(_ name: NSAttributedString.Key, value: Any, range: NSRange) {
removeAttribute(name, range: range)
addAttribute(name, value: value, range: range)
}
......@@ -47,7 +47,7 @@ extension NSMutableAttributedString {
- Parameter _ attrs: A Dictionary of NSAttributedStringKey type keys and Any type values.
- Parameter range: A NSRange.
*/
open func updateAttributes(_ attrs: [NSAttributedStringKey: Any], range: NSRange) {
open func updateAttributes(_ attrs: [NSAttributedString.Key: Any], range: NSRange) {
for (k, v) in attrs {
updateAttribute(k, value: v, range: range)
}
......@@ -58,7 +58,7 @@ extension NSMutableAttributedString {
- Parameter _ attrs: An Array of attributedStringKeys.
- Parameter range: A NSRange.
*/
open func removeAttributes(_ attrs: [NSAttributedStringKey], range: NSRange) {
open func removeAttributes(_ attrs: [NSAttributedString.Key], range: NSRange) {
for k in attrs {
removeAttribute(k, range: range)
}
......
......@@ -298,7 +298,7 @@ extension UIImage {
let screenScale = Screen.scale
let imageRect = CGRect(origin: .zero, size: size)
let hasBlur = radius > CGFloat(Float.ulpOfOne)
let hasSaturationChange = fabs(saturationDeltaFactor - 1.0) > CGFloat(Float.ulpOfOne)
let hasSaturationChange = abs(saturationDeltaFactor - 1.0) > CGFloat(Float.ulpOfOne)
if hasBlur || hasSaturationChange {
UIGraphicsBeginImageContextWithOptions(size, false, screenScale)
......
......@@ -419,7 +419,7 @@ open class NavigationDrawerController: TransitionController {
return
}
self.view.sendSubview(toBack: self.contentViewController.view)
self.view.sendSubviewToBack(self.contentViewController.view)
completion?(result)
}
}
......@@ -938,7 +938,7 @@ open class NavigationDrawerController: TransitionController {
return
}
v.windowLevel = UIWindowLevelNormal
v.windowLevel = UIWindow.Level.normal
guard let `self` = self else {
return
......@@ -959,7 +959,7 @@ open class NavigationDrawerController: TransitionController {
return
}
v.windowLevel = UIWindowLevelStatusBar + 1
v.windowLevel = UIWindow.Level.statusBar + 1
guard let `self` = self else {
return
......@@ -1042,7 +1042,7 @@ extension NavigationDrawerController {
fileprivate func prepareContentViewController() {
contentViewController.view.backgroundColor = .black
prepare(viewController: contentViewController, in: view)
view.sendSubview(toBack: contentViewController.view)
view.sendSubviewToBack(contentViewController.view)
}
/// A method that prepares the leftView.
......
......@@ -63,7 +63,7 @@ public protocol SearchBarDelegate {
open class SearchBar: Bar {
/// The UITextField for the searchBar.
@IBInspectable
open let textField = UITextField()
public let textField = UITextField()
/// Reference to the clearButton.
open fileprivate(set) var clearButton: IconButton!
......
......@@ -50,7 +50,7 @@ extension UIViewController {
open class SearchBarController: StatusBarController {
/// Reference to the SearchBar.
@IBInspectable
open let searchBar = SearchBar()
public let searchBar = SearchBar()
/// The searchBar alignment.
open var searchBarAlignment = SearchBarAlignment.top {
......
......@@ -61,7 +61,7 @@ open class Snackbar: Bar {
/// Text label.
@IBInspectable
open let textLabel = UILabel()
public let textLabel = UILabel()
open override var intrinsicContentSize: CGSize {
return CGSize(width: bounds.width, height: 49)
......
......@@ -85,7 +85,7 @@ extension UIViewController {
open class SnackbarController: TransitionController {
/// Reference to the Snackbar.
open let snackbar = Snackbar()
public let snackbar = Snackbar()
/// A boolean indicating if the Snacbar is animating.
open internal(set) var isAnimating = false
......
......@@ -133,7 +133,7 @@ extension SpringAnimation {
- Parameter animations: An animation block to execute on each view's animation.
- Parameter completion: A completion block to execute on each view's animation.
*/
open func expand(duration: TimeInterval = 0.15, delay: TimeInterval = 0, usingSpringWithDamping: CGFloat = 0.5, initialSpringVelocity: CGFloat = 0, options: UIViewAnimationOptions = [], animations: ((UIView) -> Void)? = nil, completion: ((UIView) -> Void)? = nil) {
open func expand(duration: TimeInterval = 0.15, delay: TimeInterval = 0, usingSpringWithDamping: CGFloat = 0.5, initialSpringVelocity: CGFloat = 0, options: UIView.AnimationOptions = [], animations: ((UIView) -> Void)? = nil, completion: ((UIView) -> Void)? = nil) {
guard isEnabled else {
return
}
......@@ -162,7 +162,7 @@ extension SpringAnimation {
- Parameter animations: An animation block to execute on each view's animation.
- Parameter completion: A completion block to execute on each view's animation.
*/
open func contract(duration: TimeInterval = 0.15, delay: TimeInterval = 0, usingSpringWithDamping: CGFloat = 0.5, initialSpringVelocity: CGFloat = 0, options: UIViewAnimationOptions = [], animations: ((UIView) -> Void)? = nil, completion: ((UIView) -> Void)? = nil) {
open func contract(duration: TimeInterval = 0.15, delay: TimeInterval = 0, usingSpringWithDamping: CGFloat = 0.5, initialSpringVelocity: CGFloat = 0, options: UIView.AnimationOptions = [], animations: ((UIView) -> Void)? = nil, completion: ((UIView) -> Void)? = nil) {
guard isEnabled else {
return
}
......@@ -226,7 +226,7 @@ extension SpringAnimation {
- Parameter animations: An animation block to execute on each view's animation.
- Parameter completion: A completion block to execute on each view's animation.
*/
fileprivate func expandUp(duration: TimeInterval, delay: TimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
fileprivate func expandUp(duration: TimeInterval, delay: TimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIView.AnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
for i in 0..<views.count {
let v = views[i]
v.isHidden = false
......@@ -256,7 +256,7 @@ extension SpringAnimation {
- Parameter animations: An animation block to execute on each view's animation.
- Parameter completion: A completion block to execute on each view's animation.
*/
fileprivate func contractUp(duration: TimeInterval, delay: TimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
fileprivate func contractUp(duration: TimeInterval, delay: TimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIView.AnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
for i in 0..<views.count {
let v = views[i]
......@@ -285,7 +285,7 @@ extension SpringAnimation {
- Parameter animations: An animation block to execute on each view's animation.
- Parameter completion: A completion block to execute on each view's animation.
*/
fileprivate func expandDown(duration: TimeInterval, delay: TimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
fileprivate func expandDown(duration: TimeInterval, delay: TimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIView.AnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
for i in 0..<views.count {
let v = views[i]
......@@ -317,7 +317,7 @@ extension SpringAnimation {
- Parameter animations: An animation block to execute on each view's animation.
- Parameter completion: A completion block to execute on each view's animation.
*/
fileprivate func contractDown(duration: TimeInterval, delay: TimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
fileprivate func contractDown(duration: TimeInterval, delay: TimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIView.AnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
guard let first = views.first else {
return
}
......@@ -351,7 +351,7 @@ extension SpringAnimation {
- Parameter animations: An animation block to execute on each view's animation.
- Parameter completion: A completion block to execute on each view's animation.
*/
fileprivate func expandLeft(duration: TimeInterval, delay: TimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
fileprivate func expandLeft(duration: TimeInterval, delay: TimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIView.AnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
for i in 0..<views.count {
let v = views[i]
......@@ -383,7 +383,7 @@ extension SpringAnimation {
- Parameter animations: An animation block to execute on each view's animation.
- Parameter completion: A completion block to execute on each view's animation.
*/
fileprivate func contractLeft(duration: TimeInterval, delay: TimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
fileprivate func contractLeft(duration: TimeInterval, delay: TimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIView.AnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
guard let first = views.first else {
return
}
......@@ -417,7 +417,7 @@ extension SpringAnimation {
- Parameter animations: An animation block to execute on each view's animation.
- Parameter completion: A completion block to execute on each view's animation.
*/
fileprivate func expandRight(duration: TimeInterval, delay: TimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
fileprivate func expandRight(duration: TimeInterval, delay: TimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIView.AnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
for i in 0..<views.count {
let v = views[i]
......@@ -449,7 +449,7 @@ extension SpringAnimation {
- Parameter animations: An animation block to execute on each view's animation.
- Parameter completion: A completion block to execute on each view's animation.
*/
fileprivate func contractRight(duration: TimeInterval, delay: TimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
fileprivate func contractRight(duration: TimeInterval, delay: TimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIView.AnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
guard let first = views.first else {
return
}
......
......@@ -83,7 +83,7 @@ open class StatusBarController: TransitionController {
open var shouldHideStatusBarOnRotation = false
/// A reference to the statusBar.
open let statusBar = UIView()
public let statusBar = UIView()
open override func layoutSubviews() {
super.layoutSubviews()
......
......@@ -257,7 +257,7 @@ open class TabBar: Bar {
}
/// A reference to the scroll view when the tab bar style is scrollable.
open let scrollView = UIScrollView()
public let scrollView = UIScrollView()
/// Enables and disables bouncing when swiping.
open var isScrollBounceEnabled: Bool {
......@@ -337,7 +337,7 @@ open class TabBar: Bar {
}
/// A reference to the line UIView.
open let line = UIView()
public let line = UIView()
/// A value for the line alignment.
@objc
......
......@@ -40,7 +40,7 @@ open class TableView: UITableView {
prepare()
}
public override init(frame: CGRect, style: UITableViewStyle) {
public override init(frame: CGRect, style: UITableView.Style) {
super.init(frame: frame, style: style)
prepare()
}
......
......@@ -38,7 +38,7 @@ open class TableViewCell: UITableViewCell, Pulseable, PulseableLayer {
allows the dropshadow effect on the backing layer, while clipping
the image to a desired shape within the visualLayer.
*/
open let visualLayer = CAShapeLayer()
public let visualLayer = CAShapeLayer()
/// A Pulse reference.
internal var pulse: Pulse!
......@@ -102,7 +102,7 @@ open class TableViewCell: UITableViewCell, Pulseable, PulseableLayer {
- Parameter style: A UITableViewCellStyle enum.
- Parameter reuseIdentifier: A String identifier.
*/
public override init(style: UITableViewCellStyle, reuseIdentifier: String!) {
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String!) {
super.init(style: .subtitle, reuseIdentifier: reuseIdentifier)
prepare()
}
......
......@@ -53,7 +53,7 @@ extension UIViewController {
open class TableViewController: ViewController {
/// A reference to a Reminder.
open let tableView = TableView()
public let tableView = TableView()
/// An Array of DataSourceItems.
open var dataSourceItems = [DataSourceItem]()
......
......@@ -108,7 +108,7 @@ open class TabsController: TransitionController {
/// The TabBar used to switch between view controllers.
@IBInspectable
open let tabBar = TabBar()
public let tabBar = TabBar()
/// A Boolean that indicates if the swipe feature is enabled..
......
......@@ -213,7 +213,7 @@ open class TextField: UITextField {
/// The placeholder UILabel.
@IBInspectable
open let placeholderLabel = UILabel()
public let placeholderLabel = UILabel()
/// Placeholder normal text
@IBInspectable
......@@ -249,7 +249,7 @@ open class TextField: UITextField {
/// The detailLabel UILabel that is displayed.
@IBInspectable
open let detailLabel = UILabel()
public let detailLabel = UILabel()
/// The detailLabel text value.
@IBInspectable
......
......@@ -57,7 +57,7 @@ public protocol TextStorageDelegate: NSTextStorageDelegate {
open class TextStorage: NSTextStorage {
/// A storage facility for attributed text.
open let storage = NSMutableAttributedString()
public let storage = NSMutableAttributedString()
/// The regular expression to match text fragments against.
open var expression: NSRegularExpression?
......@@ -105,7 +105,7 @@ extension TextStorage {
If you don't need this value, pass NULL.
- Returns: The attributes for the character at index.
*/
open override func attributes(at location: Int, effectiveRange range: NSRangePointer?) -> [NSAttributedStringKey: Any] {
open override func attributes(at location: Int, effectiveRange range: NSRangePointer?) -> [NSAttributedString.Key: Any] {
return storage.attributes(at: location, effectiveRange: range)
}
......@@ -126,7 +126,7 @@ extension TextStorage {
- Parameter range: A range of characters that will have their
attributes updated.
*/
open override func setAttributes(_ attrs: [NSAttributedStringKey : Any]?, range: NSRange) {
open override func setAttributes(_ attrs: [NSAttributedString.Key : Any]?, range: NSRange) {
storage.setAttributes(attrs, range: range)
edited(.editedAttributes, range: range, changeInLength: 0)
}
......@@ -138,7 +138,7 @@ extension TextStorage {
- Parameter range: A range of characters that will have their
attributes added.
*/
open override func addAttribute(_ name: NSAttributedStringKey, value: Any, range: NSRange) {
open override func addAttribute(_ name: NSAttributedString.Key, value: Any, range: NSRange) {
storage.addAttribute(name, value: value, range: range)
edited(.editedAttributes, range: range, changeInLength: 0)
}
......@@ -149,7 +149,7 @@ extension TextStorage {
- Parameter range: A range of characters that will have their
attributes removed.
*/
open override func removeAttribute(_ name: NSAttributedStringKey, range: NSRange) {
open override func removeAttribute(_ name: NSAttributedString.Key, range: NSRange) {
storage.removeAttribute(name, range: range)
edited(.editedAttributes, range: range, changeInLength: 0)
}
......
......@@ -132,7 +132,7 @@ open class TextView: UITextView {
/// The placeholder UILabel.
@IBInspectable
open let placeholderLabel = UILabel()
public let placeholderLabel = UILabel()
/// Placeholder normal text
@IBInspectable
......@@ -298,13 +298,13 @@ fileprivate extension TextView {
/// Prepares the Notification handlers.
func prepareNotificationHandlers() {
let defaultCenter = NotificationCenter.default
defaultCenter.addObserver(self, selector: #selector(handleKeyboardWillShow(notification:)), name: .UIKeyboardWillShow, object: nil)
defaultCenter.addObserver(self, selector: #selector(handleKeyboardWillHide(notification:)), name: .UIKeyboardWillHide, object: nil)
defaultCenter.addObserver(self, selector: #selector(handleKeyboardDidShow(notification:)), name: .UIKeyboardDidShow, object: nil)
defaultCenter.addObserver(self, selector: #selector(handleKeyboardDidHide(notification:)), name: .UIKeyboardDidHide, object: nil)
defaultCenter.addObserver(self, selector: #selector(handleTextViewTextDidBegin), name: .UITextViewTextDidBeginEditing, object: self)
defaultCenter.addObserver(self, selector: #selector(handleTextViewTextDidChange), name: .UITextViewTextDidChange, object: self)
defaultCenter.addObserver(self, selector: #selector(handleTextViewTextDidEnd), name: .UITextViewTextDidEndEditing, object: self)
defaultCenter.addObserver(self, selector: #selector(handleKeyboardWillShow(notification:)), name: UIResponder.keyboardWillShowNotification, object: nil)
defaultCenter.addObserver(self, selector: #selector(handleKeyboardWillHide(notification:)), name: UIResponder.keyboardWillHideNotification, object: nil)
defaultCenter.addObserver(self, selector: #selector(handleKeyboardDidShow(notification:)), name: UIResponder.keyboardDidShowNotification, object: nil)
defaultCenter.addObserver(self, selector: #selector(handleKeyboardDidHide(notification:)), name: UIResponder.keyboardDidHideNotification, object: nil)
defaultCenter.addObserver(self, selector: #selector(handleTextViewTextDidBegin), name: UITextView.textDidBeginEditingNotification, object: self)
defaultCenter.addObserver(self, selector: #selector(handleTextViewTextDidChange), name: UITextView.textDidChangeNotification, object: self)
defaultCenter.addObserver(self, selector: #selector(handleTextViewTextDidEnd), name: UITextView.textDidEndEditingNotification, object: self)
}
/// Prepares the regular expression for matching.
......@@ -361,7 +361,7 @@ fileprivate extension TextView {
return
}
guard let v = notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue else {
guard let v = notification.userInfo?[UIResponder.keyboardFrameBeginUserInfoKey] as? NSValue else {
return
}
......@@ -380,7 +380,7 @@ fileprivate extension TextView {
isKeyboardHidden = false
guard let v = notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue else {
guard let v = notification.userInfo?[UIResponder.keyboardFrameBeginUserInfoKey] as? NSValue else {
return
}
......@@ -397,7 +397,7 @@ fileprivate extension TextView {
return
}
guard let v = notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue else {
guard let v = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue else {
return
}
......@@ -416,7 +416,7 @@ fileprivate extension TextView {
isKeyboardHidden = true
guard let v = notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue else {
guard let v = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue else {
return
}
......@@ -473,7 +473,8 @@ private extension TextView {
/// latter fixes the typing font change due to the insertion of an emoji character
/// (typing font changes somehow are reflected in `UITextView.font` parameter).
func fixTypingFont() {
let fontAttribute = NSAttributedStringKey.font.rawValue
let fontAttribute = NSAttributedString.Key.font
guard (typingAttributes[fontAttribute] as? UIFont)?.fontName == "AppleColorEmoji" else {
return
}
......
......@@ -47,7 +47,7 @@ open class Toolbar: Bar {
/// Title label.
@IBInspectable
open let titleLabel = UILabel()
public let titleLabel = UILabel()
/// A convenience property to set the detailLabel.text.
@IBInspectable
......@@ -63,7 +63,7 @@ open class Toolbar: Bar {
/// Detail label.
@IBInspectable
open let detailLabel = UILabel()
public let detailLabel = UILabel()
deinit {
removeObserver(self, forKeyPath: #keyPath(titleLabel.textAlignment))
......
......@@ -51,7 +51,7 @@ extension UIViewController {
open class ToolbarController: StatusBarController {
/// Reference to the Toolbar.
@IBInspectable
open let toolbar = Toolbar()
public let toolbar = Toolbar()
/// The toolbar alignment.
open var toolbarAlignment = ToolbarAlignment.top {
......
......@@ -48,7 +48,7 @@ open class TransitionController: ViewController {
/// A reference to the container view.
@IBInspectable
open let container = UIView()
public let container = UIView()
/**
A UIViewController property that references the active
......@@ -185,9 +185,9 @@ internal extension TransitionController {
passed in controller view within the view hierarchy.
*/
func prepare(viewController: UIViewController, in container: UIView) {
addChildViewController(viewController)
addChild(viewController)
container.addSubview(viewController.view)
viewController.didMove(toParentViewController: self)
viewController.didMove(toParent: self)
viewController.view.frame = container.bounds
viewController.view.clipsToBounds = true
viewController.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
......@@ -201,8 +201,8 @@ internal extension TransitionController {
- Parameter at index: An Int for the view controller position.
*/
func removeViewController(viewController: UIViewController) {
viewController.willMove(toParentViewController: nil)
viewController.willMove(toParent: nil)
viewController.view.removeFromSuperview()
viewController.removeFromParentViewController()
viewController.removeFromParent()
}
}
......@@ -41,7 +41,7 @@ open class View: UIView {
allows the dropshadow effect on the backing layer, while clipping
the image to a desired shape within the visualLayer.
*/
open let visualLayer = CAShapeLayer()
public let visualLayer = CAShapeLayer()
/**
A property that manages an image for the visualLayer's contents
......@@ -107,17 +107,9 @@ open class View: UIView {
}
}
/// A Preset for the contentsGravity property.
@IBInspectable
open var contentsGravityPreset: Gravity {
didSet {
contentsGravity = GravityToValue(gravity: contentsGravityPreset)
}
}
/// Determines how content should be aligned within the visualLayer's bounds.
@IBInspectable
open var contentsGravity: String {
open var contentsGravity: CALayerContentsGravity {
get {
return visualLayer.contentsGravity
}
......@@ -139,7 +131,6 @@ open class View: UIView {
- Parameter aDecoder: A NSCoder instance.
*/
public required init?(coder aDecoder: NSCoder) {
contentsGravityPreset = .resizeAspectFill
super.init(coder: aDecoder)
prepare()
}
......@@ -151,7 +142,6 @@ open class View: UIView {
- Parameter frame: A CGRect instance.
*/
public override init(frame: CGRect) {
contentsGravityPreset = .resizeAspectFill
super.init(frame: frame)
prepare()
}
......@@ -171,6 +161,7 @@ open class View: UIView {
when subclassing.
*/
open func prepare() {
contentsGravity = .resizeAspectFill
contentScaleFactor = Screen.scale
backgroundColor = .white
prepareVisualLayer()
......
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