{"id":1200,"url":"https://github.com/AfrozZaheer/AZPeerToPeerConnection","last_synced_at":"2025-07-30T20:32:39.810Z","repository":{"id":56901473,"uuid":"121237032","full_name":"AfrozZaheer/AZPeerToPeerConnection","owner":"AfrozZaheer","description":"AZPeerToPeerConnectivity is a wrapper on top of Apple iOS Multipeer Connectivity framework. It provides an easier way to create and manage sessions. Easy to integrate","archived":false,"fork":false,"pushed_at":"2018-02-20T06:47:41.000Z","size":152,"stargazers_count":70,"open_issues_count":0,"forks_count":8,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-11-18T03:13:26.412Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AfrozZaheer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-12T11:11:48.000Z","updated_at":"2024-08-04T00:01:43.000Z","dependencies_parsed_at":"2022-08-21T02:50:50.045Z","dependency_job_id":null,"html_url":"https://github.com/AfrozZaheer/AZPeerToPeerConnection","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AfrozZaheer%2FAZPeerToPeerConnection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AfrozZaheer%2FAZPeerToPeerConnection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AfrozZaheer%2FAZPeerToPeerConnection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AfrozZaheer%2FAZPeerToPeerConnection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AfrozZaheer","download_url":"https://codeload.github.com/AfrozZaheer/AZPeerToPeerConnection/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228187556,"owners_count":17882324,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:15:41.112Z","updated_at":"2024-12-04T20:31:04.291Z","avatar_url":"https://github.com/AfrozZaheer.png","language":"Swift","funding_links":[],"categories":["Hardware"],"sub_categories":["Bluetooth","Other free courses"],"readme":"# AZPeerToPeerConnection Controller\n\n\n[![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)\n[![Swift version](https://img.shields.io/badge/swift%20-4.0-orange.svg)](https://img.shields.io/badge/swift%20-4.0-orange.svg)\n[![Support Dependecy Manager](https://img.shields.io/badge/support-CocoaPods-red.svg?style=flat.svg)](https://img.shields.io/badge/support-CocoaPods-red.svg?style=flat.svg)\n[![Version](https://img.shields.io/cocoapods/v/AZPeerToPeerConnection.svg?style=flat)](https://cocoapods.org/pods/AZPeerToPeerConnection)\n[![License](https://img.shields.io/badge/License-MIT-brightgreen.svg?style=flat.svg)](https://img.shields.io/badge/License-MIT-brightgreen.svg?style=flat.svg)\n[![Platform](https://img.shields.io/badge/platform-ios-lightgrey.svg)](https://cocoapods.org/pods/AZPeerToPeerConnection)\n\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://i.imgur.com/e1tKOoW.gif\"\u003e\n\u003cimg src=\"https://i.imgur.com/e1tKOoW.gif\" height=\"480\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n\n## Features\n\n* Multipeer Connectivity\n* Connection via Bluetooth or Wifi\n* No need write all session, browser, services delegate\n\n## Installation\n\n### CocoaPods\n\n[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:\n\n```bash\n$ gem install cocoapods\n```\n\nTo integrate AZ PeerToPeerConnection into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '10.0'\nuse_frameworks!\n\ntarget '\u003cYour Target Name\u003e' do\npod 'AZPeerToPeerConnection'\nend\n```\n\nThen, run the following command:\n\n```bash\n$ pod install\n```\n\n## Usage\n\n#### Step 1\n\n* With P2PServiceHandler.sharedInstance setup connection and make sure to implement it's delegate\n\n```swift\n    let connection = P2PServiceHandler.sharedInstance\n    override func viewDidLoad() {\n        super.viewDidLoad()\n        connection.delegate = self\n        connection.setupConnection(serviceName: \"AZP2Ptest\")\n\n        tableView.estimatedRowHeight = 50\n        tableView.rowHeight = UITableViewAutomaticDimension\n        textField.delegate = self\n        \n    }\n```\n#### Step 2\n\n* Next you need to connect to other devices, to do taht you just need to open McBrowser\n* You can pass your own McBrowser or just nil, it will present browser\n\n```swift\n    connection.joinSession(vc: self, mcBrowser: nil) // nil == default mcbrowsr\n\n```\n#### Step 3\n\n* Send data to other devices\n* To send data it is better to send in form of Dictionary\n\n```swift\nconnection.sendData(data: [\"message\": textField.text ?? \"defaultValue\"]) // send data of type [String: Any]\n\n```\n#### Step 4\n\n* To receive data you have to implement delegate method \n\n```swift\n    func didRecieve(_ serviceHandler: P2PServiceHandler, data: [String : Any]) {\n    \n        DispatchQueue.main.async {\n            if let val = data[\"message\"] {\n                print(val)// data recieved\n            }\n        }\n    }\n```\n\n\n#### Done\nThats it, you successfully integrate AZPeerToPeerConnection\n\n\n## License\n\nAZPeerToPeerConnection is available under the MIT license. See the LICENSE file for more info.\n\n## Author\n\n**Afroz Zaheer** - (https://github.com/AfrozZaheer)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAfrozZaheer%2FAZPeerToPeerConnection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAfrozZaheer%2FAZPeerToPeerConnection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAfrozZaheer%2FAZPeerToPeerConnection/lists"}