In this recipe, we will write the code for setting up our multiplayer game. All the configurations and session managers will be the part of this section. We will dig into the various concepts of creating and maintaining sessions.
Before starting this recipe, MCSession, MCPeerId, advertiser and service type terms of Multipeer Connectivity framework should be known to us. In this recipe we will be establishing the connection between players, thereby, they can communicate in future, making the players play a game, which we will be doing in the next chapter.
Now, on tapping the screen, a MCSession with a service type has been instantiated; we can use this session and service type to present a