Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion TGPControls.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Pod::Spec.new do |spec|

# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
spec.name = "TGPControls"
spec.version = "5.1.0"
spec.version = "5.2.0"
spec.summary = "Custom animated iOS controls: Animated discrete slider, animated labels"

spec.description = <<-DESC
Expand Down
24 changes: 12 additions & 12 deletions TGPControls/TGPCamelLabels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ public class TGPCamelLabels_INTERFACE_BUILDER:UIControl {
@IBDesignable
public class TGPCamelLabels: TGPCamelLabels_INTERFACE_BUILDER {

let validAttributes = [NSLayoutAttribute.top.rawValue, // 3
NSLayoutAttribute.centerY.rawValue, // 10
NSLayoutAttribute.bottom.rawValue] // 4
let validAttributes = [NSLayoutConstraint.Attribute.top.rawValue, // 3
NSLayoutConstraint.Attribute.centerY.rawValue, // 10
NSLayoutConstraint.Attribute.bottom.rawValue] // 4

// Only used if labels.count < 1
@IBInspectable public var tickCount:Int {
Expand Down Expand Up @@ -102,10 +102,10 @@ public class TGPCamelLabels: TGPCamelLabels_INTERFACE_BUILDER {
// Where should emphasized labels be drawn (10: centerY, 3: top, 4: bottom)
// By default, emphasized labels are animated towards the top of the frame.
// This creates the dock effect (camel). They can also be centered vertically, or move down (reverse effect).
@IBInspectable public var emphasisLayout:Int = NSLayoutAttribute.top.rawValue {
@IBInspectable public var emphasisLayout:Int = NSLayoutConstraint.Attribute.top.rawValue {
didSet {
if !validAttributes.contains(emphasisLayout) {
emphasisLayout = NSLayoutAttribute.top.rawValue
emphasisLayout = NSLayoutConstraint.Attribute.top.rawValue
}
layoutTrack()
}
Expand All @@ -114,29 +114,29 @@ public class TGPCamelLabels: TGPCamelLabels_INTERFACE_BUILDER {
// Where should regular labels be drawn (10: centerY, 3: top, 4: bottom)
// By default, emphasized labels are animated towards the bottom of the frame.
// This creates the dock effect (camel). They can also be centered vertically, or move up (reverse effect).
@IBInspectable public var regularLayout:Int = NSLayoutAttribute.bottom.rawValue {
@IBInspectable public var regularLayout:Int = NSLayoutConstraint.Attribute.bottom.rawValue {
didSet {
if !validAttributes.contains(regularLayout) {
regularLayout = NSLayoutAttribute.bottom.rawValue
regularLayout = NSLayoutConstraint.Attribute.bottom.rawValue
}
layoutTrack()
}
}

// MARK: @IBInspectable adapters

public var emphasisLayoutAttribute:NSLayoutAttribute {
public var emphasisLayoutAttribute:NSLayoutConstraint.Attribute {
get {
return NSLayoutAttribute(rawValue: emphasisLayout) ?? .top
return NSLayoutConstraint.Attribute(rawValue: emphasisLayout) ?? .top
}
set {
emphasisLayout = newValue.rawValue
}
}

public var regularLayoutAttribute:NSLayoutAttribute {
public var regularLayoutAttribute:NSLayoutConstraint.Attribute {
get {
return NSLayoutAttribute(rawValue: regularLayout) ?? .bottom
return NSLayoutConstraint.Attribute(rawValue: regularLayout) ?? .bottom
}
set {
regularLayout = newValue.rawValue
Expand Down Expand Up @@ -365,7 +365,7 @@ public class TGPCamelLabels: TGPCamelLabels_INTERFACE_BUILDER {
}
}

func verticalAlign(aView:UIView, alpha:CGFloat, attribute layout:NSLayoutAttribute) {
func verticalAlign(aView:UIView, alpha:CGFloat, attribute layout:NSLayoutConstraint.Attribute) {
switch layout {
case .top:
aView.frame = {
Expand Down
6 changes: 3 additions & 3 deletions TGPControls/TGPDiscreteSlider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ public class TGPDiscreteSlider:TGPSlider_INTERFACE_BUILDER {
return UInt(round( Double(segments) * ratio))
}

func sendActionForControlEvent(controlEvent:UIControlEvents, with event:UIEvent?) {
func sendActionForControlEvent(controlEvent:UIControl.Event, with event:UIEvent?) {
for target in allTargets {
if let caActions = actions(forTarget: target, forControlEvent: controlEvent) {
for actionName in caActions {
Expand All @@ -767,8 +767,8 @@ public class TGPDiscreteSlider:TGPSlider_INTERFACE_BUILDER {
// Interface builder hides the IBInspectable for UIControl

let allTargets: Set<AnyHashable> = Set()
func addTarget(_ target: Any?, action: Selector, for controlEvents: UIControlEvents) {}
func actions(forTarget target: Any?, forControlEvent controlEvent: UIControlEvents) -> [String]? { return nil }
func addTarget(_ target: Any?, action: Selector, for controlEvents: UIControl.Event) {}
func actions(forTarget target: Any?, forControlEvent controlEvent: UIControl.Event) -> [String]? { return nil }
func sendAction(_ action: Selector, to target: Any?, for event: UIEvent?) {}
#endif // TARGET_INTERFACE_BUILDER
}