Switching between environments in Xcode from Simulator

Viewed 46

I am working on a swiftui project , where i need to switch between three different environments and display their properties.

I am using different configurations schemes and created a new row in info.plist and using the below code snippet to achieve this.

     if let configuration = Bundle.main.object(forInfoDictionaryKey: "Configuration") as? String {
                if configuration.range(of: "Production") != nil {
                    return Environment.Production
                }
//similar condition for other two environments

Is there any way that i can trigger this action using a button in the simulator? ie, restarting the app with a different configuration when I click the button? Or atleast anything close to it?

0 Answers
Related