onevcat / Rainbow

Delightful console output for Swift developers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

.stringByApplying doesn't work

Papershine opened this issue · comments

Following to the documentation, I tried the code

let output = "The quick brown fox jumps over the lazy dog"
            .stringByApplying(Color.Red, BackgroundColor.Yellow, Style.Bold)

but the code didn't compile with the error

error: value of type 'String' has no member 'stringByApplying'
        let output = "The quick brown fox jumps over the lazy dog"
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The API was changed in Swift 3, now it should be

"Hello".applyingCodes(Color.red, BackgroundColor.yellow, Style.bold)

I'd update the readme for it soon.