title: Value of @IBInspectable set in storyboard not propagated to the code
body: <p>Without any experience with iOS, I have been asked to upgrade to Swift 4 an application that is using Swift 3. I updated the language to use in "Swift language version" and I followed the recommendations made by xCode (explicitly use <code>@objc</code>).</p>
  
  <p>Once all errors fixed the application works, but one UI-related feature is not working anymore. The app has a custom <code>UITextField</code> that is used to enter a password. Depending on the value of a <code>@IBInspectable</code> class field of the custom text field the text is hidden or not.</p>
  
  <p>The value of this variable is correctly set in MainStoryboard but when the class is instantiated this value is not set to the value in the storyboard, and as a result, the custom text field does not behave how it should. The log does not mention any error.</p>
  
  <p>Does anybody experience the same problem?</p>
  
  <p>I checked storyboard and class, I did not find any problems, I also compared the code of the version with Swift 3 and the one I updated with Swift 4 and there are no differences (except the <code>@objc</code> ones). </p>
  
  <p>Are there something else to look that can help me to find why the value set in MainStoryboard is not propagated to the class?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Below is the code involved in the problem:</p>
  
  <ul>
  <li>a variable <code>isPassword</code> is declared to reflect the value of the IBInspectable variable</li>
  <li>the variable <code>IBInspectable</code> is declared</li>
  <li><p>when <code>awakeFromNib</code> depending on the value of <code>isPassword</code> a method to either hide the text or not is called</p>
  
  <pre><code>@IBDesignable class CustomEditText: UITextField {
  var isPassword = false
  
  // Inspector variable determining if the text must be hidden or not
  @IBInspectable var isAPasswordField: Bool {
      get{
          return self.isPassword
      }
  
      set{
          self.isPassword = isAPasswordField
      }
  }
  
  override init(frame: CGRect) {
      super.init(frame: frame)
      setup()
  }
  
  required init(coder aDecoder: NSCoder) {
      super.init(coder: aDecoder)!
      setup()   // Set borders, font, ...
  }
  
  override func awakeFromNib() {
      super.awakeFromNib()
      if isPassword {               // isPassword does not reflect the value of isAPasswordField set in storyboard
          self.isSecureTextEntry = true
          setRevealButton()         // the text is hidden
      } else {
          setCustomClearButton()    // the text is not hidden
      }
  }
  </code></pre></li>
  </ul>
  
  <p>...</p>
  
  <p><strong>Answer</strong></p>
  
  <p>@Alladinian gave the good answer.
  Below for completeness, another solution that I found:</p>
  
  <pre><code>@IBInspectable var isPasswordField: Bool = false {
      didSet{
          self.isPassword = isPasswordField
  
          if isPassword {
              self.isSecureTextEntry = true
              setRevealButton()
          } else {
              setCustomClearButton()
          }
      }
  }
  </code></pre>