Skip to content

Commit

Permalink
remove routing warning
Browse files Browse the repository at this point in the history
  • Loading branch information
tanner0101 committed Dec 21, 2017
1 parent d628994 commit e950f3d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Sources/Routing/Utilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ extension String {
/// Separates a URI path into
/// an array by splitting on `/`
internal var pathComponents: [String] {
return characters
return toCharacterSequence()
.split(separator: "/", omittingEmptySubsequences: true)
.map { String($0) }
}
Expand All @@ -16,3 +16,15 @@ extension Sequence where Iterator.Element == String {
return flatMap { $0.pathComponents } .filter { !$0.isEmpty }
}
}

extension String {
#if swift(>=4.0)
internal func toCharacterSequence() -> String {
return self
}
#else
internal func toCharacterSequence() -> CharacterView {
return self.characters
}
#endif
}

0 comments on commit e950f3d

Please sign in to comment.