 }
 class AddConversionViewController: UIViewController {
     
-    enum destinationType: String{
+    enum DestinationType: String{
         case from
         case to
+        var segue: String {
+            switch self {
+            case .from: return "fromCodeSegue"
+            case .to: return "toCodeSegue"
+            }
+        }
+        init?(segue: String?) {
+            guard let theSegue = segue else {
+                return nil
+            }
+            
+            switch theSegue {
+            case DestinationType.from.segue: self = .from
+            case DestinationType.to.segue: self = .to
+            default: return nil
+            }
+        }
     }
     
     var conversion: ConversionModel = ConversionModel()

            return
        }
        
        if let type = destinationType(rawValue: d) {
            switch type {
            case .from:
                conversion.fromCode = code
                self.fromCurrencyButton.setTitle(conversion.fromCode, for: .normal)
            case .to:
                conversion.toCode = code
                self.toCurrencyButton.setTitle(conversion.toCode, for: .normal)
            }
        }
    }
}

    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        if let controller = segue.destination as? CurrenciesTableViewController {
            controller.delegate = self
            controller.currencyDestination = DestinationType(segue: segue.identifier)?.rawValue
        }
        hideAllNotifications()
    }
