Skip to content
This repository was archived by the owner on Sep 6, 2019. It is now read-only.

Ambiguous type name 'Segue' #90

@moray95

Description

@moray95

Hello,

I have just integrated Natalie with my project using the build script given in the README.
When trying to compile the generated Storyboards.swift, I am having the error Ambiguous type name 'Segue'.

The issue is caused on a custom view controller inheriting from another custom view controller, therefore, on the child view controller, the type Segue can refer to neither it's own type or it's parent's type.

The generated code looks like the following:

extension X { 

    enum Segue: String, CustomStringConvertible, SegueProtocol {
        case viewDetail = "viewDetail"

        var kind: SegueKind? {
            switch (self) {
            case .viewDetail:
                return SegueKind(rawValue: "show")
            }
        }

        var destination: UIViewController.Type? {
            switch (self) {
            default:
                assertionFailure("Unknown destination")
                return nil
            }
        }

        var identifier: String? { return self.description } 
        var description: String { return self.rawValue }
    }

}

extension UIStoryboardSegue {
    func selection() -> Y.Segue? {  // <-- Error on this line
        if let identifier = self.identifier {
            return DeliveryOrderHistoryViewController.Segue(rawValue: identifier)
        }
        return nil
    }
}

extension Y { 

    enum Segue: String, CustomStringConvertible, SegueProtocol {
        case viewDetail = "viewDetail"

        var kind: SegueKind? {
            switch (self) {
            case .viewDetail:
                return SegueKind(rawValue: "show")
            }
        }

        var destination: UIViewController.Type? {
            switch (self) {
            default:
                assertionFailure("Unknown destination")
                return nil
            }
        }

        var identifier: String? { return self.description } 
        var description: String { return self.rawValue }
    }

}

On the code above, Y inherits from X, which in turn inherits from UIViewController.

Do you have any recommendations on how to fix the issue?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions