FileKit
FileKit copied to clipboard
warning: 'ExpressibleByStringInterpolation' is deprecated
Hi, When I build your component with carthage I have these warnings:
../Sources/Carthage/Checkouts/FileKit/Sources/Path.swift:1066:17: warning: 'ExpressibleByStringInterpolation' is deprecated: it will be replaced or redesigned in Swift 4.0. Instead of conforming to 'ExpressibleByStringInterpolation', consider adding an 'init(_:String)'
../Sources/Carthage/Checkouts/FileKit/Sources/TextFile.swift:231:21: warning: conditional downcast from 'NSString?' to 'String' is a bridging conversion; did you mean to use 'as'?
This also appears in Issue Navigator when using Cocoapods. And in this case it is annoying - I don't like having warnings in my project.
Just a try with this commit 6f2353f785df388783932fe1b87c13ca3a4a278b I think PR #49 will do better job for some part and I do not want to add conflict, so I reverted
String bridging fixed
For ExpressibleByStringInterpolation I do not known how to convert the code and keep the functionality It seems to work with swift 4
Is there any update for this issue?
The warning is not the same
Initializer 'init(stringInterpolation:)' nearly matches defaulted requirement 'init(stringInterpolation:)' of protocol 'ExpressibleByStringInterpolation'
https://nshipster.com/expressiblebystringinterpolation/
maybe something like that
extension Path: ExpressibleByStringInterpolation {
public init(stringInterpolation: StringInterpolation) {
self.init(stringInterpolation.value)
}
public struct StringInterpolation: StringInterpolationProtocol {
var value: String = ""
public init(literalCapacity: Int, interpolationCount: Int) {
self.value.reserveCapacity(literalCapacity)
}
public mutating func appendLiteral(_ literal: String) {
self.value.append(literal)
}
public mutating func appendInterpolation<T>(_ value: T) where T: CustomStringConvertible {
self.value.append(value.description)
}
}
}