Skip to content

Commit 412d318

Browse files
author
Jose Alcalá Correa
committed
Update example to Swift 3
1 parent c3467ec commit 412d318

File tree

4 files changed

+22
-15
lines changed

4 files changed

+22
-15
lines changed

Example/Example.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@
564564
PROVISIONING_PROFILE = "";
565565
SWIFT_OBJC_BRIDGING_HEADER = "GSKStretchyHeaderView/Example-Bridging-Header.h";
566566
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
567-
SWIFT_VERSION = 2.3;
567+
SWIFT_VERSION = 3.0;
568568
WRAPPER_EXTENSION = app;
569569
};
570570
name = Debug;

Example/GSKStretchyHeaderView/ScalableLabelHeaderView.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ class ScalableLabelHeaderView: GSKStretchyHeaderView {
66

77
private lazy var label: UILabel = {
88
let label = UILabel(frame: CGRect(x: 0, y: 20, width: self.contentView.width, height: self.contentView.height - 20))
9-
label.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
10-
label.font = UIFont.monospacedDigitSystemFontOfSize(self.maxFontSize, weight: UIFontWeightMedium)
11-
label.textColor = UIColor.darkGrayColor()
9+
label.autoresizingMask = [.flexibleWidth, .flexibleHeight]
10+
label.font = UIFont.monospacedDigitSystemFont(ofSize: self.maxFontSize, weight: UIFontWeightMedium)
11+
label.textColor = UIColor.darkGray
1212
label.text = "Scalable text"
13-
label.textAlignment = .Center
13+
label.textAlignment = .center
1414
return label
1515
}()
1616

@@ -29,15 +29,15 @@ class ScalableLabelHeaderView: GSKStretchyHeaderView {
2929
self.minimumContentHeight = 64
3030

3131
self.contentView.addSubview(self.label)
32-
self.backgroundColor = UIColor.orangeColor()
32+
self.backgroundColor = UIColor.orange
3333
}
3434

35-
override func didChangeStretchFactor(stretchFactor: CGFloat) {
35+
override func didChangeStretchFactor(_ stretchFactor: CGFloat) {
3636
super.didChangeStretchFactor(stretchFactor)
3737

3838
let fontSize = CGFloatTranslateRange(min(1, stretchFactor), 0, 1, minFontSize, maxFontSize)
3939
if abs(fontSize - self.label.font.pointSize) > 0.05 { // to avoid changing the font too often, this could be more precise though
40-
self.label.font = UIFont.monospacedDigitSystemFontOfSize(fontSize, weight: UIFontWeightMedium)
40+
self.label.font = UIFont.monospacedDigitSystemFont(ofSize: fontSize, weight: UIFontWeightMedium)
4141
}
4242
}
4343
}

Example/GSKStretchyHeaderView/ScalableLabelViewController.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@ class ScalableLabelViewController: GSKExampleBaseTableViewController {
1212
self.configureExpandModeButton()
1313
}
1414

15-
override func viewWillAppear(animated: Bool) {
15+
override func viewWillAppear(_ animated: Bool) {
1616
super.viewWillAppear(true)
1717
self.navigationController?.gsk_setNavigationBarTransparent(true, animated: false)
1818
}
1919

2020
func configureExpandModeButton() {
21-
let buttonTitle: String = self.stretchyHeaderView.expansionMode == .TopOnly ? "Top only" : "Immediate"
22-
self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: buttonTitle, style: .Plain, target: self, action: #selector(switchExpandMode))
21+
let buttonTitle: String = self.stretchyHeaderView.expansionMode == .topOnly ? "Top only" : "Immediate"
22+
self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: buttonTitle, style: .plain, target: self, action: #selector(switchExpandMode))
2323
}
2424

2525
func switchExpandMode() {
2626
switch self.stretchyHeaderView.expansionMode {
27-
case .TopOnly:
28-
self.stretchyHeaderView.expansionMode = .Immediate
29-
case .Immediate:
30-
self.stretchyHeaderView.expansionMode = .TopOnly
27+
case .topOnly:
28+
self.stretchyHeaderView.expansionMode = .immediate
29+
case .immediate:
30+
self.stretchyHeaderView.expansionMode = .topOnly
3131
}
3232
self.configureExpandModeButton()
3333
}

Example/Pods/Pods.xcodeproj/project.pbxproj

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)