{"id":15170597,"url":"https://github.com/alecrim/reachability","last_synced_at":"2025-06-10T09:04:10.339Z","repository":{"id":54504722,"uuid":"431627811","full_name":"alecrim/Reachability","owner":"alecrim","description":"A new, clean and lean network interface reachability library written in Swift.","archived":false,"fork":false,"pushed_at":"2023-06-06T11:43:33.000Z","size":15,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-09T23:04:08.779Z","etag":null,"topics":["async","combine","network","reachability","swift","swiftui"],"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/alecrim.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-24T21:04:55.000Z","updated_at":"2025-03-31T12:44:11.000Z","dependencies_parsed_at":"2025-02-10T22:33:07.306Z","dependency_job_id":"61118d7a-aeec-4f90-9f14-8c0d0cae6723","html_url":"https://github.com/alecrim/Reachability","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecrim%2FReachability","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecrim%2FReachability/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecrim%2FReachability/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecrim%2FReachability/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alecrim","download_url":"https://codeload.github.com/alecrim/Reachability/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecrim%2FReachability/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259043761,"owners_count":22797159,"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":["async","combine","network","reachability","swift","swiftui"],"created_at":"2024-09-27T08:04:11.350Z","updated_at":"2025-06-10T09:04:10.318Z","avatar_url":"https://github.com/alecrim.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Reachability\n\nA new, clean and lean network interface reachability library written in Swift.\n\n## Remarks\n\nNetwork reachability changes can be monitored using the built-in Combine publisher or an async stream.\n\nWhile it is possible to create customised instances, a default `shared` instance is provided.\n\nThe native `NWPathMonitor` is used under the covers to provide the library functionality.\n\n## Basic Usage\n\n### Simple\n\n```swift\nimport Reachability\n\nif Reachability.shared.currentPath.isReachable {\n    print(\"We are online\")\n} else {\n    print(\"No internet\")\n}\n```\n\n### SwiftUI\n\n```swift\nimport SwiftUI\nimport Reachability\n\nstruct SomeView: View {\n    @ObservedObject var reachability = Reachability.shared\n\n    var body: some View {\n        if reachability.currentPath.isReachable {\n            // Show some data loaded from the internet\n        } else {\n            Text(\"No internet connection\")\n        }\n    }\n}\n```\n\n### Using Combine\n\n```swift\nimport Reachability\n\nvar subscriptions = Set\u003cAnyCancellable\u003e()\n\nReachability.shared.publisher\n    .sink { path in\n        if path.isReachable {\n            print(\"We are online\")\n        } else {\n            print(\"No internet\")\n        }\n    }\n    .store(in: \u0026subscriptions)\n```\n\n### Using AsyncStream\n\n```swift\nimport Reachability\n\nTask {\n    for await path in Reachability.shared.stream {\n        if path.isReachable {\n            print(\"We are online\")\n        } else {\n            print(\"No internet\")\n        }\n    }\n}\n```\n\n## Installation\n\n**Reachability** can be installed using [Swift Package Manager](https://swift.org/package-manager/), a dependency manager built into Xcode.\n\nWhile in Xcode, go to *File / Swift Packages / Add Package Dependency…* and enter the package repository URL `https://github.com/Alecrim/Reachability.git`, then follow the instructions.\n\nTo remove the dependency, select the project and open *Swift Packages* (next to *Build Settings*).\n\n## Minimum Requirements\n\n| Reachability     | Swift     | Xcode      | Platforms                                        |\n| ---------------- | --------- | ---------- | ------------------------------------------------ |\n| Reachability 1.0 | Swift 5.5 | Xcode 13.0 | macOS 10.15 / iOS 13.0 / tvOS 13.0 / watchOS 6.0 |\n\n## License\n\n**Reachability** is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falecrim%2Freachability","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falecrim%2Freachability","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falecrim%2Freachability/lists"}