Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error adding enum type to Swift Array

Tags:

ios

swift

I'm trying to add an enum type to an Array and am getting an error. I am able to add a String and other types, but this enum is failing. Does anyone know what might be going wrong here?

enum Domain {
    case Default
}

let domains: Array<Domain> = [.Default]

Thread 1:EXC_BAD_INSTRUCTION(code=EXC_i386_INVOP, subcode=0x0)

like image 765
phoganuci Avatar asked Jun 19 '26 14:06

phoganuci


1 Answers

This is definitely an Apple bug - log it! https://bugreport.apple.com

Add a second case to your Enumeration (e.g. case Other) and see that the error no longer occurs. Something crazy is going on in Swift when an Enumeration has only one case.

like image 199
fqdn Avatar answered Jun 21 '26 04:06

fqdn