TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Sep 2015 |
SPMSupports SPM | ✗ |
Maintained by ProcessOne.
Depends on: | |
FMDB | ~> 1.0 |
JSQMessagesViewController | >= 0 |
JSQSystemSoundPlayer | ~> 2.0 |
XMPPFramework | >= 0 |
To run the example project, clone the repo, and run pod install
from the Example directory first.
xmpp-messenger-ios is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "xmpp-messenger-ios"
ProcessOne, [email protected]
xmpp-messenger-ios is available under the MIT license. See the LICENSE file for more info.
Swift XMPP client using P1 Swift XMPP framework
Download or clone the project
Add this in your AppDelegate’s did finishLaunchingWithOptions to start the stream :
OneChat.start(archiving: true, delegate: nil) { (stream, error) -> Void in
}
Add in applicationWillTerminate to stop the stream :
OneChat.stop()
To get the buddy list, just conform to OneRosterDelegate by implementing the delegate :
func oneRosterContentChanged(controller: NSFetchedResultsController) {
tableView.reloadData() //Reload or other
}
To be able to send messages, you must conform to OneMessageDelegate :
First set yourself as listener in viewdidload
override func viewDidLoad() {
super.viewDidLoad()
OneMessage.sharedInstance.delegate = self
}
then implement the protocol :
func oneStream(sender: XMPPStream, didReceiveMessage message: XMPPMessage, from user: XMPPUserCoreDataStorageObject) {
if message.isChatMessageWithBody() {
let body = message.elementForName("body").stringValue()
let displayName = user.displayName
if let msg: String = message.elementForName("body")?.stringValue() {
if let from: String = message.attributeForName("from")?.stringValue() {
messagestTableView.reloadData() //Reload or other
}
}
}
}
OneMessage.sendMessage(youMessage, to: chatJid, completionHandler: { (stream, message) -> Void in
})