---
# System prepended metadata

title: Supporting SwiftUI and UIKit at the same time

---

# Supporting SwiftUI and UIKit at the same time

This document illustrates how we support both SwiftUI and UIKit version's of a screen/feature at the same time and remotely modifying desired UI framework.

Let's assume that, we are going to support both UIKit and SwiftUI versions of Notification Center feature. This feature is controlled through this [flag]() using Optimizely

#### 1. Go to [Optimizely.com](https://slice.onelogin.com/portal)

#### 2. Select `Flags` tab from the left menu
![](https://i.imgur.com/ke6itMp.png)

#### 3. Search the flag that you need
In our case, it is [Notification Center (In Progress)](https://app.optimizely.com/v2/projects/20183030120/flags/manage/notification_center_in_progress/rules/qualityAssurance), Click on it. You will be navigated to a page that has detailed information about this flag.

![](https://i.imgur.com/RCVREt3.png)

#### 4. Click `Default Variables`
After clicking, you see "+" button. Click on the "+" button

![](https://i.imgur.com/tFLDRq0.png)

#### 5. Create a string variable
This step is really important. After you press on "+" button, you will see a form with input fields that asks you to enter `Variable key` and `Default value`

In order to app to fetch correct UI framework object, you should put **ui_framework** as a key

The `Default value` can be either `swiftui` or `uikit` (case insensitive)

#### 6. Save the changes
After you have save the changes, app will be able to fetch the desired ui framework for feature that is being developed.

### How to use in the code:
This image below illustrates how it can be used in the code:

```Swift=
@Injected private var featureManager: FeatureManagerType

switch self.featureManager.getUIFramework(for: .notificationCenter) {
case .swiftui:
    // Do Swift UI configuration
case .uikit:
     // Do UIKit configuration
case .unknown:
    // Handle unknown situation when an incorrect key passed or it is not provider at all
}

```



