ios - Undeclared type in enum while the declaration is in the same file -


i'm trying make simple data type storing video or image + sound compilation error "use of undeclared type" on enum movieitem , imageitem. wrong?

struct movieitem {     let movieurl: nsurl }  struct imageitem {     let imageurl: nsurl // uiimage?     let soundurl: nsurl }  enum item {     case movieitem(movieitem) // undeclared type: movieitem     case imageitem(imageitem) // undeclared type: imageitem } 

i think compiler confused use of movieitem name of struct , use case label inside of item. if change name of case label should work:

struct movieitem {     let movieurl: nsurl }  struct imageitem {     let imageurl: nsurl // uiimage?     let soundurl: nsurl }  // changed movieitem movie , imageitem image , works enum item {     case movie(movieitem)     case image(imageitem) }