{"id":18036066,"url":"https://github.com/kjuly/kynearbyservice","last_synced_at":"2025-03-27T08:30:39.712Z","repository":{"id":214565250,"uuid":"724916770","full_name":"Kjuly/KYNearbyService","owner":"Kjuly","description":"A service for nearby discovery and communication.","archived":false,"fork":false,"pushed_at":"2025-02-04T08:54:23.000Z","size":87,"stargazers_count":13,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-23T10:51:08.161Z","etag":null,"topics":["airdrop","bluetooth","bonjour","ios","local-network","mac-catalyst","macos","multipeer-connectivity","swift","swift-ui"],"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/Kjuly.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-11-29T03:42:43.000Z","updated_at":"2025-02-04T08:54:13.000Z","dependencies_parsed_at":"2024-01-10T04:40:47.530Z","dependency_job_id":"372a026c-d4f3-4c95-81a5-e59230669be0","html_url":"https://github.com/Kjuly/KYNearbyService","commit_stats":null,"previous_names":["kjuly/kynearbyservice"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kjuly%2FKYNearbyService","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kjuly%2FKYNearbyService/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kjuly%2FKYNearbyService/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kjuly%2FKYNearbyService/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kjuly","download_url":"https://codeload.github.com/Kjuly/KYNearbyService/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245809588,"owners_count":20676013,"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":["airdrop","bluetooth","bonjour","ios","local-network","mac-catalyst","macos","multipeer-connectivity","swift","swift-ui"],"created_at":"2024-10-30T12:11:26.606Z","updated_at":"2025-03-27T08:30:39.278Z","avatar_url":"https://github.com/Kjuly.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KYNearbyService\n\nA service for nearby discovery and communication.\n\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FKjuly%2FKYNearbyService%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/Kjuly/KYNearbyService)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FKjuly%2FKYNearbyService%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/Kjuly/KYNearbyService)  \n![macOS][macOS-Badge] ![iOS][iOS-Badge]  \n[![SPM][SPM-Badge]][SPM-Link] [![CocoaPods][CocoaPods-Badge]][CocoaPods-Link] [![Carthage][Carthage-Badge]][Carthage-Link]\n\n[macOS-Badge]: https://img.shields.io/badge/macOS-12.0%2B-blue?labelColor=00367A\u0026color=3081D0\n[iOS-Badge]: https://img.shields.io/badge/iOS-15.5%2B-blue?labelColor=00367A\u0026color=3081D0\n\n[SPM-Badge]: https://img.shields.io/github/v/tag/Kjuly/KYNearbyService?label=SPM\u0026labelColor=2F4858\u0026color=A8DF8E\n[SPM-Link]: https://swiftpackageindex.com/Kjuly/KYNearbyService\n[CocoaPods-Badge]: https://img.shields.io/cocoapods/v/KYNearbyService?label=CocoaPods\u0026labelColor=2F4858\u0026color=A8DF8E\n[CocoaPods-Link]: https://cocoapods.org/pods/KYNearbyService\n[Carthage-Badge]: https://img.shields.io/github/v/tag/Kjuly/KYNearbyService?label=Carthage\u0026labelColor=2F4858\u0026color=A8DF8E\n[Carthage-Link]: https://swiftpackageindex.com/Kjuly/KYNearbyService\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/Kjuly/preview/main/KYNearbyService/01.png\" alt=\"iPhone Preview\" height=\"360\" /\u003e \n\u003cimg src=\"https://raw.githubusercontent.com/Kjuly/preview/main/KYNearbyService/Mac_01.png\" alt=\"Mac Preview\" height=\"360\" /\u003e\n\u003c/div\u003e\n\n## Installation\n\nSee the following subsections for details on the different installation methods.\n\n- [Swift Package Manager](INSTALLATION.md#swift-package-manager)\n- [CocoaPods](INSTALLATION.md#cocoaPods)\n- [Carthage](INSTALLATION.md#carthage)\n- [Submodule](INSTALLATION.md#submodule)\n\n## Usage\n\n1. Setup KYNearbyService with your service type.\n\n```Swift\nKYNearbyService.setup(with: KYNearbyServiceConfiguration(serviceType: \"your-service\")\n```\n\n\u003e [!IMPORTANT]\n\u003e Make sure you've provided [NSBonjourServices](https://developer.apple.com/documentation/bundleresources/information_property_list/nsbonjourservices) in your *.plist file.\n\u003e \n\u003e ```xml\n\u003e \u003ckey\u003eNSBonjourServices\u003c/key\u003e\n\u003e \u003carray\u003e\n\u003e   \u003cstring\u003e_your-service._tcp\u003c/string\u003e\n\u003e   \u003cstring\u003e_your-service._udp\u003c/string\u003e\n\u003e \u003c/array\u003e\n\u003e ```\n\n2. Use the existing `KYNearbyConnectionView` or setup your own one to provide as the connection view. A demo project is available under \"[/KYNearbyServiceDemo](KYNearbyServiceDemo)\".\n\n3. Observe notifications (`Notification.Name.KYNearbyService.*`) to handle events.\n\n| Notification | When | Notes\n| --- | --- | ---\n| didUpdatePeerDisplayName | The user changed the display name | The name is provided as `note.object`.\n| shouldSendResource      | The user pressed the \"SEND\" button | The target peer item (KYNearbyPeerModel instance) is provided as `note.object`. And you can use `KYNearbyService.sendResource(for:at:withName:completion:)` to send the resource to the target peer.\n| didStartReceivingResource | The service start receiving resource |\n| didReceiveResource | The service did receive resource | The details are available in `note.userInfo`. And the file will be saved to `KYNearbyServiceDefaultFolderURL.archives` by default. You can config the destination folder url by `KYNearbyServiceConfiguration`.\n\ne.g.\n\n```Swift\nNotificationCenter.default.addObserver(\n  self,\n  selector: #selector(_handleKYNearbyServiceShouldSendResourceNotification),\n  name: .KYNearbyService.shouldSendResource,\n  object: nil)\n```\n\n## All Peer Status Preview\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/Kjuly/preview/main/KYNearbyService/AllPeerStatus.png\" alt=\"iPhone Preview\" height=\"360\" /\u003e \n\u003cimg src=\"https://raw.githubusercontent.com/Kjuly/preview/main/KYNearbyService/AllPeerStatusLandscape.png\" alt=\"iPhone Preview\" height=\"260\" /\u003e\n\u003c/div\u003e\n\nYou can go to the demo project's `KYNearbyServiceDemoApp.init()`, and switch `.none` to `allPeerStatuses` to get a list of all peer statuses:\n```swift\nKYNearbyService.shared.debug_populateMockPeers(for: .allPeerStatuses)\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkjuly%2Fkynearbyservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkjuly%2Fkynearbyservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkjuly%2Fkynearbyservice/lists"}