{"id":15372980,"url":"https://github.com/rs/sdreachability","last_synced_at":"2025-04-15T12:31:38.545Z","repository":{"id":5392601,"uuid":"6581421","full_name":"rs/SDReachability","owner":"rs","description":"Easy to use and to embed Reachability library","archived":false,"fork":false,"pushed_at":"2012-12-12T15:45:31.000Z","size":122,"stargazers_count":36,"open_issues_count":0,"forks_count":6,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-28T21:11:37.405Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","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/rs.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":"2012-11-07T15:31:48.000Z","updated_at":"2024-06-19T18:51:26.000Z","dependencies_parsed_at":"2022-08-03T07:45:43.518Z","dependency_job_id":null,"html_url":"https://github.com/rs/SDReachability","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/rs%2FSDReachability","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rs%2FSDReachability/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rs%2FSDReachability/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rs%2FSDReachability/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rs","download_url":"https://codeload.github.com/rs/SDReachability/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249072252,"owners_count":21208147,"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-10-01T13:53:52.321Z","updated_at":"2025-04-15T12:31:38.321Z","avatar_url":"https://github.com/rs.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SDReachability\n\nSDReachability is a lightweight rewrite of Apple's Reachability example library focused on easy embedability and usage simplicity.\n\nMost network based library needs Reachability feature but can't embed the Apple implementation without taking the risk to name class with the same library embeded by another library or the hosted app itself. SDReachability solve this issue by letting embeders easily modify symbols exported by the library by adding their own prefix. Additionnaly, SDReachability doesn't relies on global NSNotification but uses target/action pattern.\n\nSDReachability API is revisited in order to be simpler to use. You just have to instanciate it and give it a target object with an action selector. You must store the resulting instance. You don't have to start/stop the notif(i)er, it's started immediatly after initialization and is stopped as soon as its instance is deallocated — which should happen when the host object will be deallocated itself.\n\n## Installation\n\n- Copy the .h/.m files into your project\n- In you application project application's target settings, find the \"Build Phases\" section and open the \"Link Binary With Libraries\" block\n- Click the \"+\" button again and select the `SystemConfiguration.framework`\n\n## Usage\n\nCheck if Internet is reachable:\n\n    SDReachability *reach = SDReachability.new;\n    if (reach.isReachable)\n    {\n        NSLog(@\"Connected with %@\", reach.isReachableViaWWAN ? @\"3G\" : @\"WiFi\");\n    }\n    else\n    {\n        NSLog(@\"Not Connected\");\n    }\n\nSubscribe to connectivity changes\n\n    @interface MyObject ()\n\n    @property (strong, nonatomic) SDReachability *reachability;\n\n    @end\n\n\n    @implementation MyObject\n\n    - (void)monitorReachability\n    {\n        self.reachability = [SDReachability reachabilityWithTarget:self action:@selector(reachabilityChanged:)];\n    }\n\n    - (void)reachabilityChanged:(SDReachability *)reachability\n    {\n        switch (reachability.reachabilityStatus)\n        {\n            case SDNotReachable:\n                NSLog(@\"Connection lost\");\n                break;\n\n            case SDReachableViaWiFi:\n                NSLog(@\"Connected via WiFi\");\n                break;\n\n            case SDReachableViaWWAN:\n                NSLog(@\"Connected via WWAN\");\n                break;\n        }\n    }\n\n    @end\n\n## Embedding\n\nIf you want to distribute a static library with reachability support, it's a bad idea to just copy the Apple provided Reachability demo class. Chances are that your users will already use this class either directly or through another library, leading to name claching and compilation headache.\n\nSDReachability helps you with embedding by providing an easy way to rename all exported symbols so they won't clash. To embed SDReachability into your project, copy the .h and .m files and modify the `#define` instructions at the top of the .h file like this:\n\n    #undef $SDReachability\n    #define $SDReachability MyLibraryReachability\n    #undef $SDReachabilityStatus\n    #define $SDReachabilityStatus MyLibraryReachabilityStatus\n    #undef $SDNotReachable\n    #define $SDNotReachable MyLibraryNotReachable\n    #undef $SDReachableViaWiFi\n    #define $SDReachableViaWiFi MyLibraryReachableViaWiFi\n    #undef $SDReachableViaWWAN\n    #define $SDReachableViaWWAN MyLibraryReachableViaWWAN\n\nIn your library, use MyLibraryReachability instead of SDReachability, same for all other redefined symboles.\n\n## License\n\nAll source code is licensed under the [MIT License](https://raw.github.com/rs/SDReachability/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frs%2Fsdreachability","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frs%2Fsdreachability","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frs%2Fsdreachability/lists"}