Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. func publishMessage() {
  2. if(messageTextField.text != "" || messageTextField.text != nil){
  3. let messageString: String = messageTextField.text!
  4. let messageObject : [String:Any] =
  5. [
  6. "message" : messageString,
  7. "username" : username,
  8. "uuid": client.uuid()
  9. ]
  10.  
  11. client.publish(messageObject, toChannel: channelName) { (status) in
  12. print(status.data.information)
  13. }
  14. messageTextField.text = ""
  15. }
  16.  
  17. }
  18.  
  19. //When the send button is clicked, the message will send
  20. @IBAction func sendMessage(_ sender: UIButton) {
  21. publishMessage()
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement