Skip to content

Commit bcf1e59

Browse files
jseibertpaulofaria
authored andcommitted
Swift 4 Support (#13)
1 parent 5ddeef6 commit bcf1e59

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

.swift-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0
1+
4.0

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ matrix:
55
include:
66
- os: osx
77
env: JOB=SwiftPM_OSX
8-
osx_image: xcode8.3
8+
osx_image: xcode9
99
- os: linux
1010
env: JOB=SwiftPM_linux
1111
dist: trusty
@@ -17,4 +17,3 @@ script:
1717
- swift build
1818
- swift test
1919
- eval "$(curl -sL https://raw.githubusercontent.com/lgaches/swifttravisci/master/codecov)"
20-

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import PackageDescription
33
let package = Package(
44
name: "Graphiti",
55
dependencies: [
6-
.Package(url: "https://github.com/GraphQLSwift/GraphQL.git", majorVersion: 0, minor: 2),
6+
.Package(url: "https://github.com/GraphQLSwift/GraphQL.git", majorVersion: 0, minor: 3),
77
]
88
)

Sources/Graphiti/Graphiti.swift

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,24 @@ func isProtocol(type: Any.Type) -> Bool {
2424
}
2525

2626
func fixName(_ name: String) -> String {
27+
// In Swift 4, String(describing: MyClass.self) appends ' #1' for locally defined classes,
28+
// which we consider invalid for a type name. Strip this by copying until the first space.
29+
var workingString = name
30+
2731
if name.hasPrefix("(") {
28-
var newName: [Character] = []
29-
30-
for character in String(name.characters.dropFirst()).characters {
31-
if character != " " {
32-
newName.append(character)
33-
} else {
34-
break
35-
}
32+
workingString = String(name.characters.dropFirst())
33+
}
34+
35+
var newName: [Character] = []
36+
for character in workingString.characters {
37+
if character != " " {
38+
newName.append(character)
39+
} else {
40+
break
3641
}
37-
38-
return String(newName)
3942
}
4043

41-
return name
44+
return String(newName)
4245
}
4346

4447

0 commit comments

Comments
 (0)