     
     override func prepareForReuse() {
         super.prepareForReuse()
-        propertyValue.text = ""
+        propertyValueTextField.text = ""
         propertyTitle.text = ""
-        propertyTitle.removeFromSuperview()
     }
     
     func cellWithAttributes(_ propertyTitle: String, propertyValue: String, editMode: Bool, property: Property, isArray:Bool) {
         self.propertyTitle = self.labelWithAttributes(14, weight:0.3, text: propertyTitle)
-        self.contentView.addSubview(self.propertyTitle)
-        
+        contentView.addSubview(self.propertyTitle)
         
         if isArray {
-            propertyValueLabel = self.labelWithAttributes(14, weight:0.3, text: propertyValue)
-            self.contentView.addSubview(propertyValueLabel)
-        } else {
-            self.propertyValue.isUserInteractionEnabled = editMode
-            self.isUserInteractionEnabled = editMode
-            if property.type == .bool {
-                //            self.propertyValue.userInteractionEnabled = false
-            }
-            if property.type == .float || property.type == .double {
-                self.propertyValue.keyboardType = UIKeyboardType.decimalPad
-            } else if property.type == .int {
-                self.propertyValue.keyboardType = UIKeyboardType.numberPad
-            }
-            
-            self.propertyValue.delegate = self
-            self.propertyValue.backgroundColor = .black
-            self.propertyValue.returnKeyType = .done
-            self.propertyValue.backgroundColor = .white
-            self.propertyValue.textAlignment = .right
-            
-            self.propertyValue.text = propertyValue
-            
-            self.contentView.addSubview(self.propertyValue)
+            propertyValueTextField.isUserInteractionEnabled = false
         }
+        self.propertyValueTextField.isUserInteractionEnabled = editMode
+        
+        if property.type == .float || property.type == .double {
+            propertyValueTextField.keyboardType = UIKeyboardType.decimalPad
+        } else if property.type == .int {
+            propertyValueTextField.keyboardType = UIKeyboardType.numberPad
+        }
+        
+        propertyValueTextField.delegate = self
+        propertyValueTextField.backgroundColor = .black
+        propertyValueTextField.returnKeyType = .done
+        propertyValueTextField.backgroundColor = .white
+        propertyValueTextField.textAlignment = .right
+        propertyValueTextField.text = propertyValue
+        
+        contentView.addSubview(self.propertyValueTextField)
         self.property = property
-        self.setNeedsLayout()
-        self.isUserInteractionEnabled = true
+        setNeedsLayout()
+        isUserInteractionEnabled = true
     }
     
     override func layoutSubviews() {

        if  property != nil {
            if property.type == .bool {
                
                let isEqual = (propertyValue.text! as String == "false")
                var newValue = "0"
                if isEqual {
                    newValue = "1"
                    propertyValue.text = "true"
                } else {
                    propertyValue.text = "false"
                }
                
                self.delegate.textFieldDidFinishEdit(newValue, property: self.property)
                propertyValue.resignFirstResponder()
                self.setNeedsLayout()
            }
        }
    }
    
    
    func textFieldShouldReturn(_ textField: UITextField) -> Bool {
        textField.resignFirstResponder()
        propertyValue.isUserInteractionEnabled = false
        self.delegate.textFieldDidFinishEdit(textField.text!, property: self.property)
        return true
    }
    
    func textFieldDidEndEditing(_ textField: UITextField) {
        textField.resignFirstResponder()
        propertyValue.isUserInteractionEnabled = false
        if  property.type != .bool {
            self.delegate.textFieldDidFinishEdit(textField.text!, property: self.property)
        }


class RBSRealmPropertyCell: UITableViewCell, UITextFieldDelegate {
    private var propertyTitle = UILabel()
    private var propertyValueTextField = UITextField()
    private var property: Property! = nil
    var delegate: RBSRealmPropertyCellDelegate! = nil
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        selectionStyle = .none
    }
    
    required init?(coder aDecoder: NSCoder) {
