How to query for String AND NSDate property?
<p>I am facing an odd error with my code:</p>

<pre><code>if let date = self.messages.last?.date {
    let newMessages = self.realm.objects(Message).filter("chatId == '\(self.chatId!)' AND date &gt; \(date)")
}
</code></pre>

<p>This outputs the error:</p>

<blockquote>
  <p>Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unable to parse the format string "chatId = 'oSgUGWH9fWURmBh5NQZK2POpxdI3yEdl7PrPzAU33l7cVFIpzR38otF3' AND date > 2016-07-17 10:56:07 +0000"'</p>
</blockquote>

<p>What am I doing wrong?</p>

<p><strong>EDIT:</strong></p>

<p>Using <code>NSPredicate</code> it works: </p>

<pre><code>let predicate = NSPredicate(format: "chatId = %@ AND date &gt; %@", self.chatId!, date)
newMessages = self.realm.objects(Message).filter(predicate)
</code></pre>

<p>But why doesn't the first solution work?</p>