How to use a switch statement on something like UITraitEnvironmentLayoutDirection?

114 views Asked by At

I want to find the value of UITraitEnvironmentLayoutDirection. It has the possible values of .leftToRight, .rightToLeft and .unspecified.

How do I use a switch (or some other statement) to detect which of these is the correct value?

I have tried the following:

switch UITraitEnvironmentLayoutDirection {
        case .leftToRight:
            print("left to right")
        case .rightToLeft:
            print("right to left")
        default:
            print("unknown")
    }

and it isn't valid syntax. So what is? How do I get the value?

0

There are 0 answers