Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes for swift4.2 #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
4 changes: 2 additions & 2 deletions TGPControls.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -313,7 +313,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
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
2 changes: 1 addition & 1 deletion 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 Down