Swiftformat: Removed backtick causes compiler to fail

Created on 16 Mar 2017  路  7Comments  路  Source: nicklockwood/SwiftFormat

Installed version (brew): swiftformat, version 0.26.2

Before I had:

static var type: Build.`Type` {

Now I have:

static var type: Build.Type {

Swift is not smart enough to figure it out without the backtick.

Full class:

import Foundation

struct Build {
    enum `Type`: String {
        case alpha
        case beta
        case production
    }

    static var type: Build.`Type` {
        let bundleIdentifier = Bundle.main.bundleIdentifier
        let components = bundleIdentifier!.components(separatedBy: ".")
        let lastComponent = components.last!

        if let type = self.Type(rawValue: lastComponent) {
            return type
        } else {
            return .production
        }
    }
}

Most helpful comment

Fixed in 0.27.0

All 7 comments

Thanks, I'll look into it.

Fixed in 0.27.0

Fantastic, thanks!

Still happening in version 0.28.1

screen shot 2017-03-30 at 15 35 34

Doesn't seem like I can reopen this issue, could you do it for me?

Sorry about that, I thought it was fixed, but it seems not. I'll take another look.

Fixed in 0.28.2

Was this page helpful?
0 / 5 - 0 ratings

Related issues

soranoba picture soranoba  路  3Comments

MaxDesiatov picture MaxDesiatov  路  3Comments

dcramps picture dcramps  路  3Comments

PompeiaPaetenari picture PompeiaPaetenari  路  4Comments

Cyberbeni picture Cyberbeni  路  4Comments