Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I want my custom Error type has name "Error"

Not "MyError" or with any other prefixes or suffixes. I want it to be just "Error". Because when I refer this type in the code it would be like: MyApp.Error. Nice and simple.

enum MyApp {
    enum SomeModel {}
    enum OneMoreModel {}
    enum Error: Error {
        
    }
}

It does’t compile:

‘Error’ has a raw type that depends on itself

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I tried Error: swift.Error but

Cannot find type ‘swift’ in scope

What else can I try?

>Solution :

The name of the module is Swift, with a capital "S".

enum Error: Swift.Error {
    
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading