title: How to perform if let binding with struct in swift
body: <p>I now the output produce by this piece of code but my problem is that how could I perform if let binding on struct in swift.</p>
  
  <p>Is if let binding is not possible with struct in swift. if yes that how could we do that</p>
  
  <pre><code>struct Account {
      var name: String
      init(name: String) {
          self.name = name
      }
  }
  
  struct AccountViewModel {
      private var account: Account
  
      var accountName: String {
          return "Account Name &gt;&gt;&gt;&gt;&gt; " + self.account.name
      }
  
      init(acc: Account) {
          self.account = acc
      }
  
      mutating func updateAccountName(name: String) {
          self.account.name = name
      }
  }
  
  let acc = Account.init(name: "First Account")
  print("Account Name &gt;&gt;&gt;&gt;&gt;", acc.name)
  
  var accountVM: AccountViewModel?
  accountVM = AccountViewModel.init(acc: acc)
  
  if var accVM = accountVM {
      accVM.updateAccountName(name: "Update Name")
  }
  
  print(accountVM?.accountName ?? "")
  </code></pre>