# Generics Enum in Swift

If we want handle different data type, according to the result of calling some APIs. We may need the code like this.

But the code above cannot be compiled.

### How can we actually do this

We can use Container Class.

But it is awful to write bunch of code for creating container classes, for each type you need.

### Better Solution?

Here is a very useful lib. https://github.com/robrix/Box

It provide a container class called Box

### Finally

We can rewrite above code into this. Much more elegant.