0

How can I add a new case in enum UIModalTransitionStyle?

Is that feasible using swift extension?

Swift document about extension says that: Extensions add new functionality to an existing class, structure, enumeration, or protocol type.

Does it mean, I can create an extension for enum?

UIModalTransitionStyle has following four cases:

I want to add one more case push in it. How can I do that?

I found only this on SO, that doesn't help (or I'm unable to understand, how to use that solution for my problem resolution) :

Krunal
  • 77,632
  • 48
  • 245
  • 261
  • 1
    Extensible enums are discussed here: https://github.com/apple/swift-evolution/blob/master/proposals/0192-non-exhaustive-enums.md. – Martin R May 04 '18 at 16:51

1 Answers1

0

AFAIK there is no way to directly add more cases to an enum. The documentation refers to adding for e.g. computed properties and functions to an existing enumeration.

Your best bet would be extending UIModalTransitionStyle with more cases with the method described in this answer.

Tamás Sengel
  • 55,884
  • 29
  • 169
  • 223