Building the chat interface
To be able to chat, you will need to create a new View Controller for the chat interface. From the Xcode menu, select File > New > File.... Choose a Cocoa Touch Class, name it ChatViewController with a subclass of UIViewController and language of Objective-C.

This will create a new file called ChatViewController.m, at the top import NexmoClient and User.
The chat interface will need:
- A
UITextViewto show the chat messages - A
UITextFieldto type messages into
Open ChatViewController.m and add it programmatically.
In the viewWillAppear function an observer is added to the keyboardDidShowNotification which calls the keyboardWasShown. The keyboardWasShown function adjusts the layout margins of the view which moves the input field. This stops the inputField being blocked by the keyboard when typing.
The UITextField delegate
You will need to conform to the UITextFieldDelegate to know when the user has finished typing to move the input field to its original position.
At the end of the ChatViewController class add the textFieldDidEndEditing delegate function.
Presenting the ChatViewController
Now that the chat interface is built you will need to present the view controller from the log in screen you built earlier. You will need information about the logged in user to be passed between the two view controllers, within ChatViewController.h import the User class at the top of the file.
Add an initializer to the interface.
Then in ChatViewController.m, add a user and client property to the interface.
Implement the initializer:
This defines a custom initializer for the class which has a User.type as its parameter, which then gets stored in the local user property. Now that you have the user information, use the navigation bar to show who the user will be chatting with, in viewDidLoad add the following.
This will also creates a logout button in the navigation bar, add the logout function to the end of ChatViewController.m.
Now you are ready to present the chat interface along with the user information. To do this you will need to edit the didChangeConnectionStatus function in the ViewController.m file.
Then import ChatViewController at the top of the file.
If the user connects successfully a ChatViewController will be presented with the user data needed.
Build and Run
Run the project again (Cmd + R) to launch it in the simulator. If you log in with one of the users you will see the chat interface

Creating an iOS chat app
Create a iOS application that enables users to message each other