iosswiftxcodefeaturetoggle

hide feature toggle in production mode


I want to create a feature toggle in the settings bundle of our app. So, if we on/off the toggle, we can show/hide a specific feature that's currently being developed. But, I don't want to show the toggle option on the production settings yet. Users who download the app don't need to see this feature. So, How do I hide the toggle if its on production mode?


Solution

  • Wrapped the Toggle in #if DEBUG

    #if DEBUG
    Toggle(isOn: .constant(true), label: {
        Text("Label")
    })
    #endif