Protocol extension where clause fails

Trying to add the following code to my iOS project in Fire and getting 3 compilation errors. It works in Xcode 9.4. I know the 2nd and 3rd errors are because of renaming and should be updated in Fire. I suspect the first is similar, but don’t know the old way of doing it.

protocol Storyboarded {
  static func instantiate() -> Self
}

extension Storyboarded where Self: UIViewController {                            // identifier expected error
    static func instantiate() -> Self {
        let fullName = NSStringFromClass(self)
        let className = fullName.components(separatedBy: ".")[1]                 // no such member on components
        let storyboard = UIStoryboard(name: "Main", bundle: Bundle.main)         // no such static member

        return storyboard.instantiateViewController(withIdentifier: className) as! Self
    }
}

The first error seems like. possible compiler bug or limitation. I’ll log to have tis looked at.

The other two errors, alas, come down to the Grand Rename being a constant battle as Apple’ rules for how to destroy Cocoa’s nice APIs are inconsistent, and their own compiler does not follow their specs. turns out we rename this to

fullName.componentsSeparated(by: )

with our “version” of Apple’s renaming rules :(. I could try tweaking this but then a dozen other things will break, it’s a very frustrating situation.

Personally, I suggest just going with th real Cocoa names (which Elements’ Swift lets you still use), they are much nicer anyways. e.g.

fullName.componentsSeparatedBy()

in this case. But I’ll see if we can tweak MakeSwifty further.

(fwiw, I’d be happy to open up the MakeSwift code, if anyone wants rot take a stab at maintaining/tweaking that, as a community project…

Thanks, logged as bugs://80584

I understand your frustration. I can deal with the renamed items easily enough and it doesn’t bother me. They must have an exception list for the grand rename. :slight_smile:

bugs://80584 got closed with status fixed.