Procházet zdrojové kódy

Update syntax to support all swift versions

yifanfu před 7 roky
rodič
revize
8baefd9071
3 změnil soubory, kde provedl 5 přidání a 0 odebrání
  1. binární
      .DS_Store
  2. 5 0
      Sources/HttpParser.swift
  3. binární
      XCode/.DS_Store

binární
.DS_Store


+ 5 - 0
Sources/HttpParser.swift

@@ -39,7 +39,12 @@ public class HttpParser {
         let queryStart = url.index(after: questionMark)
 
         guard url.endIndex > queryStart else { return [] }
+
+        #if swift(>=4.0)
         let query = String(url[queryStart..<url.endIndex])
+        #else
+        guard let query = String(url[queryStart..<url.endIndex]) else { return [] }
+        #endif
 
         return query.components(separatedBy: "&")
             .reduce([(String, String)]()) { (c, s) -> [(String, String)] in

binární
XCode/.DS_Store