Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warning: 'ExpressibleByStringInterpolation' is deprecated #47

Open
TofPlay opened this issue May 26, 2017 · 5 comments
Open

warning: 'ExpressibleByStringInterpolation' is deprecated #47

TofPlay opened this issue May 26, 2017 · 5 comments

Comments

@TofPlay
Copy link

TofPlay commented May 26, 2017

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'?
@ivankolesnik
Copy link

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.

@phimage phimage reopened this Aug 14, 2017
@phimage
Copy link
Collaborator

phimage commented Aug 14, 2017

Just a try with this commit 6f2353f
I think PR #49 will do better job for some part and I do not want to add conflict, so I reverted

@phimage
Copy link
Collaborator

phimage commented Sep 30, 2017

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

@phimage phimage changed the title Carthage: warnings warning: 'ExpressibleByStringInterpolation' is deprecated Jan 17, 2018
@Cookiezby
Copy link

Is there any update for this issue?

@phimage
Copy link
Collaborator

phimage commented Apr 26, 2019

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)
        }
    }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants