title: Set inputview for Searchbar - Swift
body: <pre><code>class TestViewController: UIViewController, UISearchBarDelegate {
  
    @IBOutlet weak var mySearchBar: UISearchBar!
    var myOwnInputView = UIView(frame: CGRectMake(100,100,50,50))
  
    overide func viewDidLoad() {
      mySearchBar.delegate = self
      mySearchBar.inputView = myOwnInputView // errors - "Cannot assign to the result of this expression
    }
  
  }
  </code></pre>
  
  <p>I'm trying to assign a custom input view to my search bar, however based on apple documentation (-sorry could not find link anymore), for UISearchBar it seems to be a read-only value.  Looking at <a href="https://stackoverflow.com/questions/20278677/how-to-change-inputview-of-uisearchbar-in-ios7">this post</a>, it appears that UISearchbar has multiple subviews and I need to get to the UITextField part in order to change the inputview.  However, I'm not sufficiently familiar with Obj-C and my attempts to convert the code to Swift have not been successful.</p>