enum can not have dynamic cases, so adding new cases on the fly based on 
customer input would not work.

However, a struct could have a dictionary or array property and that property 
could grow with customers input.

You will still need a way to store the inputs - assuming you want to be able to 
persist the information.

> On Jul 17, 2015, at 12:53 PM, Michael de Haan  <m...@comcast.net> wrote:
> 
> I wonder if I can get some input as I seemed to have hit a wall in Swift, 2.0
> 
> My App uses structs and enums to hold the bulk of the data needed for it’s  
> default values (probably over 95%). So, for example, 
> 
> enum Foo:String {
> 
>    case Bar = “Bar"
>    case Etc = “Etc"
>    case Etc_Etc = “Etc Etc"
> }
> 
> 
> As a very small percentage of the app, I want to allow the user to add a 
> custom “raw-Value" of Type Foo. In essence, it would be as if the user had 
> added another case to the enum.
> 
> 
> 
> let x = Foo(rawValue: “newRawValue”) not unsurprisingly,  returns “nil".
> 
> I know that I could use Core Data to store the data, but it seems that for so 
> trivial amount of user data,I should be able to do it without resorting to 
> Core Data.
> 
> Or, I may be approaching it the wrong way entirely.
> 
> Your thoughts would be greatly appreciated.
> 
> 
> 
> 
> 
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/iseecolors%40rsqrdc.us
> 
> This email sent to iseecol...@rsqrdc.us


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to