Skip to content

Commit

Permalink
Update to Swift 4.2, Xcode 10
Browse files Browse the repository at this point in the history
  • Loading branch information
vtourraine committed Aug 21, 2018
1 parent aa6224b commit c332003
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0
4.2
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode9
osx_image: xcode10

script:
- xcodebuild test -workspace AcknowList.xcworkspace -scheme AcknowList -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 7,OS=11.0' ONLY_ACTIVE_ARCH=NO
- xcodebuild test -workspace AcknowList.xcworkspace -scheme AcknowList -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 8,OS=12.0' ONLY_ACTIVE_ARCH=NO
2 changes: 1 addition & 1 deletion AcknowList.podspec.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
"tvos": "9.0"
},
"frameworks": "UIKit",
"swift_version": "4.0"
"swift_version": "4.2"
}
16 changes: 6 additions & 10 deletions AcknowList.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,11 @@
TargetAttributes = {
1AA3C3731CAC35190071A7FD = {
CreatedOnToolsVersion = 7.3;
LastSwiftMigration = 0900;
LastSwiftMigration = 1000;
};
1AA3C37D1CAC35190071A7FD = {
CreatedOnToolsVersion = 7.3;
LastSwiftMigration = 0900;
LastSwiftMigration = 1000;
};
};
};
Expand Down Expand Up @@ -449,8 +449,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
name = Debug;
Expand All @@ -471,8 +470,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
name = Release;
Expand All @@ -486,8 +484,7 @@
PRODUCT_BUNDLE_IDENTIFIER = net.vtourraine.AcknowListTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -500,8 +497,7 @@
PRODUCT_BUNDLE_IDENTIFIER = net.vtourraine.AcknowListTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 1.7 (work in progress)

- Update to Swift 4.2
- Filter out manual line wrapping from licenses text, by Albert Zhang (@azhang66)


Expand Down
10 changes: 3 additions & 7 deletions Example/AcknowExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
TargetAttributes = {
1F6C52A61B7F495700B9A7CC = {
CreatedOnToolsVersion = 6.4;
LastSwiftMigration = 0900;
LastSwiftMigration = 1000;
};
D7A999402058275600A3F668 = {
CreatedOnToolsVersion = 9.2;
Expand Down Expand Up @@ -355,6 +355,7 @@
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand Down Expand Up @@ -404,6 +405,7 @@
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
Expand All @@ -419,8 +421,6 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "net.vtourraine.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -434,8 +434,6 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "net.vtourraine.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand All @@ -458,7 +456,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
Expand All @@ -481,7 +478,6 @@
PRODUCT_BUNDLE_IDENTIFIER = net.vourraine.AcknowExampleTV;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

_Ready to use “Acknowledgements”/“Licenses”/“Credits” view controller for [CocoaPods](http://cocoapods.org/)._

_Written in Swift 4 (for Objective-C, you can use [VTAcknowledgementsViewController](https://github.com/vtourraine/VTAcknowledgementsViewController))._
_Written in Swift 4.2 (for Objective-C, you can use [VTAcknowledgementsViewController](https://github.com/vtourraine/VTAcknowledgementsViewController))._

![Platform iOS](https://img.shields.io/cocoapods/p/AcknowList.svg)
![Swift 4](https://img.shields.io/badge/Swift-4-blue.svg)
![Swift 4.2](https://img.shields.io/badge/Swift-4.2-blue.svg)
[![Build Status](https://travis-ci.org/vtourraine/AcknowList.svg?branch=master)](https://travis-ci.org/vtourraine/AcknowList)
[![CocoaPods compatible](https://img.shields.io/cocoapods/v/AcknowList.svg)](https://cocoapods.org/pods/AcknowList)
[![MIT license](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/vtourraine/AcknowList/raw/master/LICENSE)
Expand Down Expand Up @@ -54,7 +54,7 @@ AcknowList is also compatible with tvOS for Apple TV apps.

## Requirements

AcknowList is written in Swift 4, requires iOS 8.0 or tvOS 9.0 and above, Xcode 9.0 and above.
AcknowList is written in Swift 4.2, requires iOS 8.0 or tvOS 9.0 and above, Xcode 9.0 and above.


## Credits
Expand Down
8 changes: 4 additions & 4 deletions Source/AcknowListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ open class AcknowListViewController: UITableViewController {
let font = UIFont.preferredFont(forTextStyle: .footnote)
let options: NSStringDrawingOptions = NSStringDrawingOptions.usesLineFragmentOrigin
// should be (NSLineBreakByWordWrapping | NSStringDrawingUsesLineFragmentOrigin)?
let labelBounds: CGRect = labelText.boundingRect(with: CGSize(width: labelWidth, height: CGFloat.greatestFiniteMagnitude), options: options, attributes: [NSAttributedStringKey.font: font], context: nil)
let labelBounds: CGRect = labelText.boundingRect(with: CGSize(width: labelWidth, height: CGFloat.greatestFiniteMagnitude), options: options, attributes: [NSAttributedString.Key.font: font], context: nil)
let labelHeight = labelBounds.height

return CGFloat(ceilf(Float(labelHeight)))
Expand Down Expand Up @@ -381,14 +381,14 @@ open class AcknowListViewController: UITableViewController {
cell = dequeuedCell
}
else {
cell = UITableViewCell(style: UITableViewCellStyle.default, reuseIdentifier: CellIdentifier)
cell = UITableViewCell(style: UITableViewCell.CellStyle.default, reuseIdentifier: CellIdentifier)
}

if let acknowledgements = self.acknowledgements,
let acknowledgement = acknowledgements[(indexPath as NSIndexPath).row] as Acknow?,
let textLabel = cell.textLabel as UILabel? {
textLabel.text = acknowledgement.title
cell.accessoryType = UITableViewCellAccessoryType.disclosureIndicator
cell.accessoryType = UITableViewCell.AccessoryType.disclosureIndicator
}

return cell
Expand Down Expand Up @@ -420,6 +420,6 @@ open class AcknowListViewController: UITableViewController {
- returns: A nonnegative floating-point value that estimates the height (in points) that `row` should be. Return `UITableViewAutomaticDimension` if you have no estimate.
*/
open override func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableViewAutomaticDimension
return UITableView.automaticDimension
}
}
4 changes: 2 additions & 2 deletions Source/AcknowViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ open class AcknowViewController: UIViewController {

view.backgroundColor = UIColor.white
#endif
textView.textContainerInset = UIEdgeInsetsMake(TopBottomDefaultMargin, LeftRightDefaultMargin, TopBottomDefaultMargin, LeftRightDefaultMargin)
textView.textContainerInset = UIEdgeInsets.init(top: TopBottomDefaultMargin, left: LeftRightDefaultMargin, bottom: TopBottomDefaultMargin, right: LeftRightDefaultMargin)
view.addSubview(textView)

self.textView = textView
Expand Down Expand Up @@ -106,6 +106,6 @@ open class AcknowViewController: UIViewController {
}

func updateTextViewInsets(_ textView: UITextView) {
textView.textContainerInset = UIEdgeInsetsMake(TopBottomDefaultMargin, self.view.layoutMargins.left, TopBottomDefaultMargin, self.view.layoutMargins.right);
textView.textContainerInset = UIEdgeInsets.init(top: TopBottomDefaultMargin, left: self.view.layoutMargins.left, bottom: TopBottomDefaultMargin, right: self.view.layoutMargins.right);
}
}

0 comments on commit c332003

Please sign in to comment.