title: Compound key in Realm with lazy property
body: <p>I found this great solution for using Realm with compound primary key in Swift: <a href="https://github.com/realm/realm-cocoa/issues/1192" rel="nofollow">https://github.com/realm/realm-cocoa/issues/1192</a></p>
  
  <pre><code>public final class Card: Object {
    public dynamic var id = 0 {
        didSet {
            compoundKey = compoundKeyValue()
        }
    }
    public dynamic var type = "" {
        didSet {
            compoundKey = compoundKeyValue()
        }
    }
    public dynamic lazy var compoundKey: String = self.compoundKeyValue()
    public override static func primaryKey() -&gt; String? {
        return "compoundKey"
    }
  
    private func compoundKeyValue() -&gt; String {
        return "\(id)-\(type)"
    }
  }
  </code></pre>
  
  <p>But I discovered that Realm does not support lazy properties, in my case I receive this error:</p>
  
  <blockquote>
    <p>exception NSException *   name: "RLMException" - reason: "Lazy managed property 'compoundKey' is not allowed on a Realm Swift object class. Either add the property to the ignored properties list or make it non-lazy."  0x00007f8a05108060</p>
  </blockquote>
  
  <p>Is it still possible to have compound key without lazy property?</p>