Skip to content

Commit

Permalink
Support Swift 4.2 (#2)
Browse files Browse the repository at this point in the history
* migrate to Swift 4.2 package manager description and fix build errors

* fix test target path not to contain LinuxMain
  • Loading branch information
banjun authored and autozimu committed Nov 27, 2018
1 parent 6a85bc8 commit 7107cfc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.3
4.2.0
7 changes: 6 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
// swift-tools-version:4.2
import PackageDescription

let package = Package(
name: "StringMetric"
name: "StringMetric",
targets: [
.target(name: "StringMetric", path: "Sources"),
.testTarget(name: "StringMetricTests", dependencies: ["StringMetric"], path: "Tests/StringMetricTests")
]
)
4 changes: 2 additions & 2 deletions Sources/StringExt.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extension String {
func index(_ i: Int) -> String.CharacterView.Index {
func index(_ i: Int) -> String.Index {
if i >= 0 {
return self.index(self.startIndex, offsetBy: i)
} else {
Expand All @@ -16,6 +16,6 @@ extension String {
}

subscript(r: Range<Int>) -> String {
return self[index(r.lowerBound)..<index(r.upperBound)]
return String(self[index(r.lowerBound)..<index(r.upperBound)])
}
}

0 comments on commit 7107cfc

Please sign in to comment.