Multipeer Connectivity in Xcode Creating a Chat App for iOS

  • Tihomir Radev

Your browser needs to be JavaScript capable to view this video

Try reloading this page, or reviewing your browser settings

You're watching a preview of subscription content. Log in to check access

Create a simple chat app for iOS using the Multipeer Connectivity framework. Multipeer Connectivity is an important development in the latest iOS. Using this framework, you’ll provide users an interactive way to communicate and exchange data between each other.

You’ll see how to set one of the users as the host, and allow other users to join the hosted chat. Then each participant will be able to send a message in a shared room between all of the users. You’ll achieve this by implementing the Multipeer Connectivity framework, setting up the room protocols, and creating pathways for the exchange of data with users in the room. Learn how to create multi-screen apps; save simple data, such as a person’s screen name, indefinitely; and add a few storyboard elements, such as buttons and textfields. Finally, this video gives you a skeleton for creating other apps, such as a multiplayer game linked between different devices.

What You Will Learn

  • Create basic Xcode projects for iOS

  • Implement the Multipeer Connectivity framework

  • Create host and guest functionality and exchange data between devices

Who This Video Is For

Developers with more advanced skills in Xcode and Swift.

Multipeer Connectivity in Xcode is a video that shows how to create a simple chat app for iOS using the Multipeer Connectivity framework.

About The Author

Tihomir Radev

Tihomir Radev is a freelance mobile app developer operating in Bulgaria. He has years of experience as an independent developer and has contributed to corporate and industry projects. He also has indie projects of his own available on the Google Play and App stores. Tihomir creates Android Studio and Xcode tutorials on YouTube in addition to his development work to give back to the development community.


Supporting material

View source code at GitHub.

About this video

Tihomir Radev
Online ISBN
Total duration
34 min
Copyright information
© Tihomir Radev 2021

Related content

Video Transcript

Hello. I’m going to show you how to create a simple chat app for iOS using peer connectivity. The app will be with very basic design, so I can show you the actual functions. We will have two screens. The first screen will be a simple login screen with the text field for the nickname in the bottom, and the second screen will be the actual chat screen containing chat history field, buttons to start the chat, and to send a message.

Here, you will also learn how to connect the two screens and move between them. Next, you will learn how to connect all the UI elements with the code. We need to do this so we can assign functions and logic for each of them later in the tutorial. We will also make first test of the app in a simulator so we can see the design.

Next, we will implement the multi-peer connectivity framework, and implement the necessary methods. This will be just the basic skeleton of the app. Later, we will fill them with our logic. Here, we will fill the main logic into the previous implemented mode peer functions.

We will start a broadcast, listen to broadcasting devices, connect the devices, and send string data between them. Finally, we will test the app in the simulator. Actually, we will use two simulators, so we can test the connection between them, and test sending the messages. We will clean some stuff, and finalize the app.