Skip to content

Commit

Permalink
Update project files to Swift 4 [swift].
Browse files Browse the repository at this point in the history
  • Loading branch information
cbpowell committed Dec 2, 2017
1 parent fbab999 commit df42804
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 38 deletions.
2 changes: 1 addition & 1 deletion Extras/SingleShotOffscreenLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ open class SingleShotOffscreenLabel: MarqueeLabel {
}
}

public func pauseAndClear() {
@objc public func pauseAndClear() {
// Pause label offscreen
pauseLabel()
// Change text to nil
Expand Down
48 changes: 24 additions & 24 deletions MarqueeLabelSwift/MarqueeLabelDemoViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ class MarqueeLabelDemoViewController : UIViewController {
demoLabel2.leadingBuffer = 40.0

let attributedString2 = NSMutableAttributedString(string:"This is a long string, that's also an attributed string, which works just as well!")
attributedString2.addAttribute(NSFontAttributeName, value: UIFont(name: "Helvetica-Bold", size: 18)!, range: NSMakeRange(0, 21))
attributedString2.addAttribute(NSBackgroundColorAttributeName, value: UIColor.lightGray, range: NSMakeRange(0, 14))
attributedString2.addAttribute(NSForegroundColorAttributeName, value: UIColor(red: 0.234, green: 0.234, blue: 0.234, alpha: 1.0), range: NSMakeRange(0, attributedString2.length))
attributedString2.addAttribute(NSFontAttributeName, value: UIFont(name: "HelveticaNeue-Light", size: 18)!, range: NSMakeRange(21, attributedString2.length - 21))
attributedString2.addAttribute(NSAttributedStringKey.font, value: UIFont(name: "Helvetica-Bold", size: 18)!, range: NSMakeRange(0, 21))
attributedString2.addAttribute(NSAttributedStringKey.backgroundColor, value: UIColor.lightGray, range: NSMakeRange(0, 14))
attributedString2.addAttribute(NSAttributedStringKey.foregroundColor, value: UIColor(red: 0.234, green: 0.234, blue: 0.234, alpha: 1.0), range: NSMakeRange(0, attributedString2.length))
attributedString2.addAttribute(NSAttributedStringKey.font, value: UIFont(name: "HelveticaNeue-Light", size: 18)!, range: NSMakeRange(21, attributedString2.length - 21))
demoLabel2.attributedText = attributedString2


Expand Down Expand Up @@ -114,10 +114,10 @@ class MarqueeLabelDemoViewController : UIViewController {
demoLabel6.trailingBuffer = 30.0

let attributedString6 = NSMutableAttributedString(string:"This is a long, attributed string, that's set up to loop in a continuous fashion!")
attributedString6.addAttribute(NSForegroundColorAttributeName, value: UIColor(red: 0.123, green: 0.331, blue: 0.657, alpha: 1.000), range: NSMakeRange(0,34))
attributedString6.addAttribute(NSForegroundColorAttributeName, value: UIColor(red: 0.657, green: 0.096, blue: 0.088, alpha: 1.000), range: NSMakeRange(34, attributedString6.length - 34))
attributedString6.addAttribute(NSFontAttributeName, value: UIFont(name: "HelveticaNeue-Light", size:18.0)!, range: NSMakeRange(0, 16))
attributedString6.addAttribute(NSFontAttributeName, value: UIFont(name: "HelveticaNeue-Light", size:18.0)!, range: NSMakeRange(33, attributedString6.length - 33))
attributedString6.addAttribute(NSAttributedStringKey.foregroundColor, value: UIColor(red: 0.123, green: 0.331, blue: 0.657, alpha: 1.000), range: NSMakeRange(0,34))
attributedString6.addAttribute(NSAttributedStringKey.foregroundColor, value: UIColor(red: 0.657, green: 0.096, blue: 0.088, alpha: 1.000), range: NSMakeRange(34, attributedString6.length - 34))
attributedString6.addAttribute(NSAttributedStringKey.font, value: UIFont(name: "HelveticaNeue-Light", size:18.0)!, range: NSMakeRange(0, 16))
attributedString6.addAttribute(NSAttributedStringKey.font, value: UIFont(name: "HelveticaNeue-Light", size:18.0)!, range: NSMakeRange(33, attributedString6.length - 33))
demoLabel6.attributedText = attributedString6;
}

Expand Down Expand Up @@ -153,17 +153,17 @@ class MarqueeLabelDemoViewController : UIViewController {
demoLabel3.text = "This is a short, centered label."

let attributedString2 = NSMutableAttributedString(string: "This is a different longer string, but still an attributed string, with new different attributes!")
attributedString2.addAttribute(NSForegroundColorAttributeName, value: UIColor.black, range: NSMakeRange(0, attributedString2.length))
attributedString2.addAttribute(NSFontAttributeName, value: UIFont(name: "Helvetica-Bold", size:18.0)!, range:NSMakeRange(0, attributedString2.length))
attributedString2.addAttribute(NSBackgroundColorAttributeName, value: UIColor(white:0.600, alpha:1.000), range:NSMakeRange(0,33))
attributedString2.addAttribute(NSFontAttributeName, value: UIFont(name: "HelveticaNeue-Light", size:18.0)!, range:NSMakeRange(19, attributedString2.length - 19))
attributedString2.addAttribute(NSAttributedStringKey.foregroundColor, value: UIColor.black, range: NSMakeRange(0, attributedString2.length))
attributedString2.addAttribute(NSAttributedStringKey.font, value: UIFont(name: "Helvetica-Bold", size:18.0)!, range:NSMakeRange(0, attributedString2.length))
attributedString2.addAttribute(NSAttributedStringKey.backgroundColor, value: UIColor(white:0.600, alpha:1.000), range:NSMakeRange(0,33))
attributedString2.addAttribute(NSAttributedStringKey.font, value: UIFont(name: "HelveticaNeue-Light", size:18.0)!, range:NSMakeRange(19, attributedString2.length - 19))
demoLabel2.attributedText = attributedString2;

let attributedString6 = NSMutableAttributedString(string: "This is a different, longer, attributed string, that's set up to loop in a continuous fashion!")
attributedString6.addAttribute(NSForegroundColorAttributeName, value:UIColor(red:0.657, green:0.078, blue:0.067, alpha:1.000), range:NSMakeRange(0,attributedString6.length))
attributedString6.addAttribute(NSFontAttributeName, value:UIFont(name: "HelveticaNeue-Light", size:18.0)!, range:NSMakeRange(0, 16))
attributedString6.addAttribute(NSFontAttributeName, value:UIFont(name: "HelveticaNeue-Light", size:18.0)!, range:NSMakeRange(33, attributedString6.length - 33))
attributedString6.addAttribute(NSForegroundColorAttributeName, value: UIColor(red:0.123, green:0.331, blue:0.657, alpha:1.000), range:NSMakeRange(33, attributedString6.length - 33))
attributedString6.addAttribute(NSAttributedStringKey.foregroundColor, value:UIColor(red:0.657, green:0.078, blue:0.067, alpha:1.000), range:NSMakeRange(0,attributedString6.length))
attributedString6.addAttribute(NSAttributedStringKey.font, value:UIFont(name: "HelveticaNeue-Light", size:18.0)!, range:NSMakeRange(0, 16))
attributedString6.addAttribute(NSAttributedStringKey.font, value:UIFont(name: "HelveticaNeue-Light", size:18.0)!, range:NSMakeRange(33, attributedString6.length - 33))
attributedString6.addAttribute(NSAttributedStringKey.foregroundColor, value: UIColor(red:0.123, green:0.331, blue:0.657, alpha:1.000), range:NSMakeRange(33, attributedString6.length - 33))
demoLabel6.attributedText = attributedString6;

demoLabel1.tag = 102;
Expand All @@ -172,23 +172,23 @@ class MarqueeLabelDemoViewController : UIViewController {
demoLabel3.text = "That also scrolls left, then right, rather than in a continuous loop!"

let attributedString2 = NSMutableAttributedString(string: "This is a long string, that's also an attributed string, which works just as well!")
attributedString2.addAttribute(NSFontAttributeName, value: UIFont(name: "Helvetica-Bold", size:18.0)!, range:NSMakeRange(0, 21))
attributedString2.addAttribute(NSBackgroundColorAttributeName, value: UIColor.lightGray, range:NSMakeRange(10,11))
attributedString2.addAttribute(NSForegroundColorAttributeName, value: UIColor(red:0.234, green:0.234, blue:0.234, alpha:1.000), range:NSMakeRange(0,attributedString2.length))
attributedString2.addAttribute(NSFontAttributeName, value: UIFont(name: "HelveticaNeue-Light", size:18.0)!, range: NSMakeRange(21, attributedString2.length - 21))
attributedString2.addAttribute(NSAttributedStringKey.font, value: UIFont(name: "Helvetica-Bold", size:18.0)!, range:NSMakeRange(0, 21))
attributedString2.addAttribute(NSAttributedStringKey.backgroundColor, value: UIColor.lightGray, range:NSMakeRange(10,11))
attributedString2.addAttribute(NSAttributedStringKey.foregroundColor, value: UIColor(red:0.234, green:0.234, blue:0.234, alpha:1.000), range:NSMakeRange(0,attributedString2.length))
attributedString2.addAttribute(NSAttributedStringKey.font, value: UIFont(name: "HelveticaNeue-Light", size:18.0)!, range: NSMakeRange(21, attributedString2.length - 21))
demoLabel2.attributedText = attributedString2

let attributedString6 = NSMutableAttributedString(string: "This is a long, attributed string, that's set up to loop in a continuous fashion!")
attributedString6.addAttribute(NSForegroundColorAttributeName, value:UIColor(red:0.123, green:0.331, blue:0.657, alpha:1.000), range:NSMakeRange(0,attributedString6.length))
attributedString6.addAttribute(NSFontAttributeName, value:UIFont(name: "HelveticaNeue-Light", size:18.0)!, range:NSMakeRange(0, 16))
attributedString6.addAttribute(NSFontAttributeName, value:UIFont(name: "HelveticaNeue-Light", size:18.0)!, range:NSMakeRange(33, attributedString6.length - 33))
attributedString6.addAttribute(NSAttributedStringKey.foregroundColor, value:UIColor(red:0.123, green:0.331, blue:0.657, alpha:1.000), range:NSMakeRange(0,attributedString6.length))
attributedString6.addAttribute(NSAttributedStringKey.font, value:UIFont(name: "HelveticaNeue-Light", size:18.0)!, range:NSMakeRange(0, 16))
attributedString6.addAttribute(NSAttributedStringKey.font, value:UIFont(name: "HelveticaNeue-Light", size:18.0)!, range:NSMakeRange(33, attributedString6.length - 33))
demoLabel6.attributedText = attributedString6

demoLabel1.tag = 101;
}
}

func pauseTap(_ recognizer: UIGestureRecognizer) {
@objc func pauseTap(_ recognizer: UIGestureRecognizer) {
let continuousLabel2 = recognizer.view as! MarqueeLabel
if recognizer.state == .ended {
continuousLabel2.isPaused ? continuousLabel2.unpauseLabel() : continuousLabel2.pauseLabel()
Expand Down
16 changes: 10 additions & 6 deletions MarqueeLabelSwift/MarqueeLabelSwift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,11 @@
TargetAttributes = {
EA167D011CA8B43700DBF930 = {
CreatedOnToolsVersion = 7.3;
LastSwiftMigration = 0800;
LastSwiftMigration = 0910;
};
EAE4AC7E1CA8DE70006C1ECC = {
CreatedOnToolsVersion = 7.3;
LastSwiftMigration = 0800;
LastSwiftMigration = 0910;
};
};
};
Expand Down Expand Up @@ -402,7 +402,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.charlespowell.MarqueeLabelSwiftDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -416,7 +417,8 @@
PRODUCT_BUNDLE_IDENTIFIER = com.charlespowell.MarqueeLabelSwiftDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand All @@ -437,7 +439,8 @@
PRODUCT_BUNDLE_IDENTIFIER = com.charlespowell.MarqueeLabelSwift;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand All @@ -462,7 +465,8 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down
16 changes: 10 additions & 6 deletions MarqueeLabelTV/MarqueeLabelTV.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@
TargetAttributes = {
EA59AC061CAA28D80052AD98 = {
CreatedOnToolsVersion = 7.3;
LastSwiftMigration = 0800;
LastSwiftMigration = 0910;
};
EAE4ACB51CAA23FD006C1ECC = {
CreatedOnToolsVersion = 7.3;
LastSwiftMigration = 0800;
LastSwiftMigration = 0910;
};
};
};
Expand Down Expand Up @@ -264,7 +264,8 @@
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "appletvsimulator appletvos";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
VERSIONING_SYSTEM = "apple-generic";
Expand All @@ -291,7 +292,8 @@
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "appletvsimulator appletvos";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
VERSIONING_SYSTEM = "apple-generic";
Expand Down Expand Up @@ -407,7 +409,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.charlespowell.MarqueeLabelTV;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -421,7 +424,8 @@
PRODUCT_BUNDLE_IDENTIFIER = com.charlespowell.MarqueeLabelTV;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion MarqueeLabelTV/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class MarqueeCell: UITableViewCell {
}

extension UITableViewCell: TextCell {
var cellText: String? {
@objc var cellText: String? {
get {
return textLabel?.text
}
Expand Down

0 comments on commit df42804

Please sign in to comment.