title: Update Realm primary key value swift
body: <p>Im using Realm for my iOS app and for a table i have a primary key "name"</p>
  
  <pre><code>                let application  = Application()
                  application.domain = app.domain
                  application.name = app.name
                  realm.add(application)
  </code></pre>
  
  <p>now when it try to update the name it throws an error </p>
  
  <pre><code>app?.name = newName
  </code></pre>
  
  <p>the error is </p>
  
  <pre><code>Primary key can't be changed after an object is inserted.
  </code></pre>
  
  <p>How do i solve this problem ?</p>
  
  <p>this is how I declare the primary key</p>
  
  <pre><code>override static func primaryKey() -&gt; String? {
          return "name"
      }
  </code></pre>