Skip to content

Commit

Permalink
Updates to swift 4.1 (#14)
Browse files Browse the repository at this point in the history
- Resolves Coder.getFieldName(codingPath:) returning erroneous verbose output instead of a simple String value with Swift 4.1
  • Loading branch information
ShihabMehboob authored and djones6 committed Mar 5, 2018
1 parent a493848 commit 8821f72
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ matrix:
- os: osx
osx_image: xcode9.2
sudo: required
env: SWIFT_SNAPSHOT=4.0.3
- os: linux
dist: trusty
sudo: required
env: SWIFT_SNAPSHOT=swift-4.1-DEVELOPMENT-SNAPSHOT-2018-02-06-a
- os: osx
osx_image: xcode9.2
sudo: required
env: SWIFT_SNAPSHOT=swift-4.1-DEVELOPMENT-SNAPSHOT-2018-02-06-a

before_install:
- git clone https://github.com/IBM-Swift/Package-Builder.git
Expand Down
6 changes: 5 additions & 1 deletion Sources/KituraContracts/CodableQuery/Coder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public class Coder {

/// Helper method to extract the field name from a CodingKey array
public static func getFieldName(from codingPath: [CodingKey]) -> String {
return codingPath.flatMap({"\($0)"}).joined(separator: ".")
#if swift(>=4.1)
return codingPath.compactMap({$0.stringValue}).joined(separator: ".")
#else
return codingPath.flatMap({$0.stringValue}).joined(separator: ".")
#endif
}
}

0 comments on commit 8821f72

Please sign in to comment.