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

Update to Swift 4.2 syntax #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
43 changes: 5 additions & 38 deletions SwiftRangeSlider/RangeSlider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -257,15 +257,15 @@ import QuartzCore
upperKnob.contentsScale = UIScreen.main.scale
layer.addSublayer(upperKnob)

lowerLabel.alignmentMode = kCAAlignmentCenter
lowerLabel.alignmentMode = CATextLayerAlignmentMode.center
lowerLabel.fontSize = labelFontSize
lowerLabel.frame = CGRect(x: 0, y: 0, width: 75, height: labelFontSize)
lowerLabel.contentsScale = UIScreen.main.scale
lowerLabel.font = UIFont.systemFont(ofSize: labelFontSize)
lowerLabel.foregroundColor = labelColor.cgColor
layer.addSublayer(lowerLabel)

upperLabel.alignmentMode = kCAAlignmentCenter
upperLabel.alignmentMode = CATextLayerAlignmentMode.center
upperLabel.fontSize = labelFontSize
upperLabel.frame = CGRect(x: 0, y: 0, width: 75, height: labelFontSize)
upperLabel.contentsScale = UIScreen.main.scale
Expand Down Expand Up @@ -340,8 +340,8 @@ import QuartzCore
lowerLabel.foregroundColor = labelColor.cgColor
upperLabel.foregroundColor = labelColor.cgColor

lowerLabelTextSize = (lowerLabel.string as! NSString).size(attributes: [NSFontAttributeName : UIFont.systemFont(ofSize: labelFontSize)])
upperLabelTextSize = (upperLabel.string as! NSString).size(attributes: [NSFontAttributeName : UIFont.systemFont(ofSize: labelFontSize)])
lowerLabelTextSize = (lowerLabel.string as! NSString).size(withAttributes: [NSAttributedString.Key.font : UIFont.systemFont(ofSize: labelFontSize)])
upperLabelTextSize = (upperLabel.string as! NSString).size(withAttributes: [NSAttributedString.Key.font : UIFont.systemFont(ofSize: labelFontSize)])
}

///Updates the labels positions above the knobs.
Expand Down Expand Up @@ -492,7 +492,7 @@ import QuartzCore
func animateKnob(knob: RangeSliderKnob, selected:Bool) {
CATransaction.begin()
CATransaction.setAnimationDuration(0.3)
CATransaction.setAnimationTimingFunction(CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseIn))
CATransaction.setAnimationTimingFunction(CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeIn))

knob.transform = selected ? CATransform3DMakeScale(selectedKnobDiameterMultiplier, selectedKnobDiameterMultiplier, 1) : CATransform3DIdentity

Expand Down Expand Up @@ -544,36 +544,3 @@ import QuartzCore
return CGPoint(x: rect.midX, y: rect.midY)
}
}