Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the best place to define enums in swift?

Tags:

xcode

ios

swift

I am writing a model class for my application and I am wondering where I should define an enum that the class will use. Should it be in the class or outside of it?

like image 856
Sam Kirkiles Avatar asked Dec 03 '22 17:12

Sam Kirkiles


1 Answers

If only the one class uses the enum, then you should define it inside your class. But if more then one class uses your enum, you should create it in it's own file.

like image 161
Christian Avatar answered Dec 24 '22 12:12

Christian