Alamofire: Swift 4 Warning: (String slicing subscript instead of substring(with:))

Created on 29 Aug 2017  路  2Comments  路  Source: Alamofire/Alamofire

What did you do?

I changed the Swift Language Version from 3 to 4.

What did you expect to happen?

Since this project promises to run in a swift 4 language environment, it should not cause any issues.

What happened instead?

I get three warnings of the same type:
'substring(with:)' is deprecated: Please use String slicing subscript.

  • ParameterEncoding.swift[226]: let substring = string.substring(with: range)
  • Request.swift[311]: components.append("-b \"(string.substring(to: string.characters.index(before: string.endIndex)))\"")
  • Validation.swift[51]: let split = stripped.substring(to: stripped.range(of: ";")?.lowerBound ?? stripped.endIndex)

Alamofire Environment

Alamofire version: 4.5.0
Xcode version: 9.0 beta 5
Swift version: 4
Platform(s) running Alamofire: iOS
macOS version running Xcode: 10.12.6

support

Most helpful comment

These are fixed on master. We'll try to get them into a release soon.

All 2 comments

These are fixed on master. We'll try to get them into a release soon.

components.append("-b \"(string.substring(to: string.characters.index(before: string.endIndex)))\"")

Was this page helpful?
0 / 5 - 0 ratings