title: Getting XMPP client chat history between two users
body: <p>I have created a XMPP Swift Messenger with the eJabbered, but it doesn't save the history.</p>
  
  <p>I searched a lot and could found just answers written in ObjC, in Stack.</p>
  
  <p>For instance:</p>
  
  <pre><code>- (void)loadChatHistoryWithUserName:(NSString *)userName {
      NSString *userJid = [NSString stringWithFormat:@"%@@%@",userName,self.hostName];
      NSManagedObjectContext *moc = [_xmppMsgStorage mainThreadManagedObjectContext];
      NSEntityDescription *entityDescription = [NSEntityDescription entityForName:@"XMPPMessageArchiving_Message_CoreDataObject"
                                                       inManagedObjectContext:moc];
      NSFetchRequest *request = [[NSFetchRequest alloc]init];
  [request setEntity:entityDescription];
      NSError *error;
      NSString *predicateFrmt = @"bareJidStr == %@";
      NSPredicate *predicate = [NSPredicate predicateWithFormat:predicateFrmt, userJid];
  request.predicate = predicate;
      NSArray *messages = [moc executeFetchRequest:request error:&amp;error];
  }
  </code></pre>
  
  <p>But I use XMPP Swift Framework with the XMPP ObjC Framework inside. Look at this Git: <a href="https://github.com/nemesit/SwiftXMPP" rel="nofollow">GitHub</a></p>
  
  <p>How can I use those snippet in Swift for getting chat history? </p>