devxoul / URLNavigator

⛵️ Elegant URL Routing for Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compile error for `URLConvertible`

secretworry opened this issue · comments

image

The String.init?(_: String) returns an optional, it should be unwrapped before using as a subscription index.

Which version of Swift and Xcode are you using?

@devxoul Sorry for the late reply.
Swift 4.1, and Xcode 9.3.1.
Since the String#subscript(_: Range<String.Index>) returns String, why bothering wrapping it with String.init?(_ description: String)

Hmm, this is weird. What I used is String.init(_ substring: Substring). Because component[keyRange] returns a Substring so I had to convert it into a String.

@secretworry, I think you were using Swift 3 for URLNavigator. Try checking your Podfile.

@devxoul my fault. thx, that solved my problem. I switched to swift 4.0 manually and didn't change the version for the pod.