How to make a custom class for Multipeer Connectivity

So I was asking a question in the Apple Forums on how to keep a multipeer connectivity through view controllers and someone answered saying that I needed to make a custom class and run the multipeer code in there. I have no idea how I would do this. Can someone private message me or something? Also, how would I call this data in my view controller's swift file?