├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── docs.yml │ ├── rebase.yml │ ├── swift.yml │ └── swiftlint.yml ├── .gitignore ├── .jazzy.yaml ├── .makefiles ├── bundler.mk ├── help.awk ├── ios.mk └── ludicrous.mk ├── .swiftlint.yml ├── .swiftpm └── xcode │ └── package.xcworkspace │ └── contents.xcworkspacedata ├── .travis.yml ├── Assets └── Logo.png ├── CHANGELOG.md ├── Cartfile ├── Cartfile.resolved ├── LICENSE ├── Makefile ├── Package.resolved ├── Package.swift ├── README.md ├── RxReachability-Example ├── Podfile ├── Podfile.lock ├── RxReachability │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ └── ViewController.swift ├── RxReachability_Example.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ ├── RxReachability.xcscheme │ │ └── RxReachability_Example.xcscheme └── RxReachability_Example.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── RxReachability.podspec ├── Sources └── RxReachability │ ├── ObservableType+Reachability.swift │ └── Reachability+Rx.swift ├── Tests ├── LinuxMain.swift └── RxReachabilityTests │ ├── RxReachabilityTests.swift │ └── XCTestManifests.swift └── docs ├── Extensions ├── ObservableType.html └── Reactive.html ├── Observable Factories.html ├── Observables.html ├── badge.svg ├── css ├── highlight.css └── jazzy.css ├── docsets ├── RxReachability.docset │ ├── Contents │ │ ├── Info.plist │ │ └── Resources │ │ │ ├── Documents │ │ │ ├── Extensions │ │ │ │ ├── ObservableType.html │ │ │ │ └── Reactive.html │ │ │ ├── Observable Factories.html │ │ │ ├── Observables.html │ │ │ ├── css │ │ │ │ ├── highlight.css │ │ │ │ └── jazzy.css │ │ │ ├── img │ │ │ │ ├── carat.png │ │ │ │ ├── dash.png │ │ │ │ ├── gh.png │ │ │ │ └── spinner.gif │ │ │ ├── index.html │ │ │ ├── js │ │ │ │ ├── jazzy.js │ │ │ │ ├── jazzy.search.js │ │ │ │ ├── jquery.min.js │ │ │ │ ├── lunr.min.js │ │ │ │ └── typeahead.jquery.js │ │ │ └── search.json │ │ │ └── docSet.dsidx │ └── icon.png ├── RxReachability.tgz └── RxReachability.xml ├── img ├── carat.png ├── dash.png ├── gh.png └── spinner.gif ├── index.html ├── js ├── jazzy.js ├── jazzy.search.js ├── jquery.min.js ├── lunr.min.js └── typeahead.jquery.js ├── search.json └── undocumented.json /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Lines starting with '#' are comments. 2 | # Each line is a file pattern followed by one or more owners. 3 | 4 | # These owners will be the default owners for everything in the repo. 5 | * @JoeMatt 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | --- 5 | 6 | ## Describe the bug 7 | 8 | 9 | 10 | ## To Reproduce 11 | 12 | 19 | 20 | ## Expected behavior 21 | 22 | 23 | 24 | ## Screenshots/stack traces/Logs 25 | 26 | 27 | 28 | ## Version 29 | 30 | 31 | 32 | ## Additional context 33 | 34 | 35 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | --- 5 | 6 | ## Overview 7 | 8 | 9 | 10 | 11 | ## Reasons 12 | 13 | 14 | 15 | ## Priority 16 | 17 | 18 | 19 | ## Considerations / Context 20 | 21 | 22 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## What does this PR do? 2 | 3 | ## Where should the reviewer start? 4 | 5 | ## How should this be manually tested? 6 | 7 | ## Any background context you want to provide? 8 | 9 | ## What are the relevant tickets? 10 | 11 | ## Screenshots (if appropriate) 12 | 13 | ## Questions -------------------------------------------------------------------------------- /.github/workflows/docs.yml: -------------------------------------------------------------------------------- 1 | name: PublishDocumentation 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | jobs: 8 | deploy_docs: 9 | runs-on: macos-latest 10 | steps: 11 | - uses: actions/checkout@v1 12 | - name: Publish Jazzy Docs 13 | uses: steven0351/publish-jazzy-docs@v1 14 | with: 15 | personal_access_token: ${{ secrets.ACCESS_TOKEN }} 16 | config: .jazzy.yaml 17 | 18 | -------------------------------------------------------------------------------- /.github/workflows/rebase.yml: -------------------------------------------------------------------------------- 1 | # Rebase PR branch when someone comments /rebase 2 | on: 3 | issue_comment: 4 | types: [created] 5 | name: Automatic Rebase 6 | jobs: 7 | rebase: 8 | name: Rebase 9 | if: contains(github.event.comment.body, '/rebase') 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@master 13 | - name: Automatic Rebase 14 | uses: cirrus-actions/rebase@master 15 | env: 16 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 17 | -------------------------------------------------------------------------------- /.github/workflows/swift.yml: -------------------------------------------------------------------------------- 1 | name: Swift PM 2 | 3 | on: 4 | pull_request: 5 | types: 6 | - reopened 7 | - opened 8 | - synchronize 9 | 10 | jobs: 11 | swift-pm: 12 | 13 | runs-on: macOS-latest 14 | 15 | steps: 16 | - uses: actions/checkout@master 17 | - name: Swift Setup 18 | uses: YOCKOW/Action-setup-swift@v1 19 | with: 20 | swift-version: '5.3.2' 21 | - run: swift --version 22 | - name: Resolve 23 | run: swift package resolve 24 | - name: Test 25 | run: swift test 26 | -------------------------------------------------------------------------------- /.github/workflows/swiftlint.yml: -------------------------------------------------------------------------------- 1 | name: Swift Lint 2 | 3 | on: 4 | pull_request: 5 | paths: 6 | - ".github/workflows/swiftlint.yml" 7 | - ".swiftlint.yml" 8 | - "RxReachability-Example/**/*.swift" 9 | - "Sources/**/*.swift" 10 | - "Tests/**/*.swift" 11 | 12 | jobs: 13 | swift-lint: 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v1 18 | - name: GitHub Action for SwiftLint 19 | uses: norio-nomura/action-swiftlint@3.2.1 20 | env: 21 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Open # OS X 2 | .DS_Store 3 | 4 | # Xcode 5 | build/ 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata 15 | *.xccheckout 16 | profile 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.xccheckout 21 | # AppCode 22 | .idea/ 23 | 24 | Carthage 25 | 26 | Demo/Pods 27 | .ruby-version 28 | .ruby-gemset 29 | # Swift Package Manager 30 | .build 31 | Packages 32 | Package.pins 33 | 34 | Pods 35 | .bundle 36 | *.log 37 | -------------------------------------------------------------------------------- /.jazzy.yaml: -------------------------------------------------------------------------------- 1 | # ---- About ---- 2 | module: RxReachability 3 | module_version: 1.2.1 4 | author: RxSwiftCommunity 5 | author_url: https://community.rxswift.org 6 | readme: README.md 7 | copyright: '© 2021 This library belongs to RxSwiftCommunity. RxReachability is available under the MIT license. See the [LICENSE](https://github.com/RxSwiftCommunity/RxReachability/develop/LICENSE.md) file for more info.' 8 | 9 | # ---- URLs ---- 10 | root_url: https://community.rxswift.org/RxReachability/ 11 | github_url: https://github.com/RxSwiftCommunity/RxReachability 12 | github_file_prefix: https://github.com/RxSwiftCommunity/RxReachabilitytree/version/1.2.1/ 13 | dash_url: https://community.rxswift.org/RxReachability/docsets/RxReachability.xml 14 | 15 | # ---- Sources ---- 16 | documentation: docs/reference/**/*.md 17 | # abstract: documentation/_abstract/*.md 18 | include: ./**/*.swift 19 | framework_root: Sources/ 20 | source_directory: Sources/ 21 | podspec: RxReachability.podspec 22 | 23 | # ---- Formatting ---- 24 | theme: apple #fullwidth 25 | 26 | # ---- Generation ---- 27 | clean: true 28 | output: docs/ 29 | min_acl: public 30 | hide_documentation_coverage: false 31 | # undocumented_text: "" 32 | skip_undocumented: false 33 | objc: false 34 | # swift_version: 5.1 35 | sdk: iphonesimulator 36 | 37 | # ---- Unused ---- 38 | docset_icon: Assets/Logo.png 39 | 40 | # ---- Custom Catagories sidebar ---- 41 | 42 | custom_categories: 43 | - name: Observables 44 | children: 45 | - Reactive 46 | - name: Observable Factories 47 | children: 48 | - Reachability 49 | - ObservableType 50 | -------------------------------------------------------------------------------- /.makefiles/bundler.mk: -------------------------------------------------------------------------------- 1 | # Provides a dependecy, `bundle`, which runs bundle install when necessary. 2 | # Override bundle install options by setting BUNDLE_INSTALL_OPTS. 3 | BE := bundle exec 4 | BUNDLE_INSTALL_OPTS ?= 5 | 6 | Gemfile.lock: Gemfile FORCE | _program_bundle 7 | @bundle check > /dev/null 2>&1 && \ 8 | ( $(call _log,rubygems up-to-date) ) || \ 9 | ( $(call _log,installing rubygems); \ 10 | bundle install $(BUNDLE_INSTALL_OPTS) ) 11 | 12 | #> installs rubygems 13 | bundle:: Gemfile.lock 14 | 15 | .PHONY: bundle 16 | -------------------------------------------------------------------------------- /.makefiles/help.awk: -------------------------------------------------------------------------------- 1 | # Awk program for automatically generating help text from those ludicrous makefiles. 2 | # See help.mk for details. 3 | function len(a, i, k) { 4 | for (i in a) k++ 5 | return k 6 | } 7 | 8 | function join(a, sep) { 9 | result = "" 10 | if (sep == "") 11 | sep = SUBSEP 12 | for (item in a) 13 | result = result sep a[item] 14 | return result 15 | } 16 | 17 | function unjoin(a, text, sep) { 18 | if (sep == "") 19 | sep = SUBSEP 20 | split(substr(text, 2), a, sep) 21 | } 22 | 23 | function append(a, item) { 24 | a[len(a) + 1] = item 25 | } 26 | 27 | function extend(a, b) { 28 | for (item in b) 29 | append(a, b[item]) 30 | } 31 | 32 | /^#> / { 33 | comments[++comments_counter] = substr($0, 4) 34 | } 35 | 36 | /^[^: \t]*:[^;]*;?/ { 37 | split($0, recipe_firstline, ":") 38 | target = recipe_firstline[1] 39 | 40 | width = length(target) 41 | max_width = (max_width > width) ? max_width : width 42 | 43 | if ( substr(lastline, 1, 2) == "#>" ) { 44 | target_docs[target] = join(comments, "#") 45 | delete comments 46 | } 47 | } 48 | 49 | !/^#>/ { 50 | if (len(comments) > 0) { 51 | extend(global_docs, comments) 52 | append(global_docs, "") 53 | delete comments 54 | } 55 | } 56 | 57 | { lastline = $0 } 58 | 59 | END { 60 | 61 | for (doc in global_docs) 62 | print global_docs[doc] 63 | 64 | printf "Targets:\n" 65 | 66 | for (target in target_docs) { 67 | unjoin(help, target_docs[target], "#") 68 | printf " %-" max_width "s %s\n", target, help[1] 69 | for (i = 2; i <= len(help); i++) 70 | printf " %-" max_width "s %s\n", "", help[i] 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /.makefiles/ios.mk: -------------------------------------------------------------------------------- 1 | SHELL := /bin/bash 2 | .PHONY: help update pull bootstrap 3 | 4 | RUBY := $(shell command -v ruby 2>/dev/null) 5 | CARTHAGE := $(shell command -v carthage 2>/dev/null) 6 | PODS := $(shell command -v pod 2>/dev/null) 7 | HOMEBREW := $(shell command -v brew 2>/dev/null) 8 | BUNDLER := $(shell command -v bundle 2>/dev/null) 9 | SWIFTGEN := $(shell command -v swiftgen 2>/dev/null) 10 | SWIFTLINT := $(shell command -v swiftlint 2>/dev/null) 11 | PLATFORM := 'iOS,tvOS,macOS,watchOS' 12 | 13 | WORKSPACE := '$(shell ls -d */*.xc* | head -1)' 14 | 15 | default: help 16 | 17 | # Add the following 'help' target to your Makefile 18 | # And add help text after each target name starting with '\#\#' 19 | # A category can be added with @category 20 | 21 | # COLORS 22 | GREEN := $(shell tput -Txterm setaf 2) 23 | YELLOW := $(shell tput -Txterm setaf 3) 24 | WHITE := $(shell tput -Txterm setaf 7) 25 | RESET := $(shell tput -Txterm sgr0) 26 | 27 | #>----- Helper functions ------ 28 | 29 | # Helper target for declaring an external executable as a recipe dependency. 30 | # For example, 31 | # `my_target: | _program_awk` 32 | # will fail before running the target named `my_target` if the command `awk` is 33 | # not found on the system path. 34 | _program_%: FORCE 35 | @_=$(or $(shell which $* 2> /dev/null),$(error `$*` command not found. Please install `$*` and try again)) 36 | 37 | # Helper target for declaring required environment variables. 38 | # 39 | # For example, 40 | # `my_target`: | _var_PARAMETER` 41 | # 42 | # will fail before running `my_target` if the variable `PARAMETER` is not declared. 43 | _var_%: FORCE 44 | @_=$(or $($*),$(error `$*` is a required parameter)) 45 | 46 | _tag: | _var_VERSION 47 | make --no-print-directory -B README.md 48 | git commit -am "Tagging release $(VERSION)" 49 | git tag -a $(VERSION) $(if $(NOTES),-m '$(NOTES)',-m $(VERSION)) 50 | .PHONY: _tag 51 | 52 | _push: | _var_VERSION 53 | git push origin $(VERSION) 54 | git push origin master 55 | .PHONY: _push 56 | 57 | #> Install dependencies. 58 | setup: \ 59 | pre_setup \ 60 | check_for_ruby \ 61 | check_for_homebrew \ 62 | update_homebrew \ 63 | install_carthage \ 64 | install_bundler_gem \ 65 | install_ruby_gems \ 66 | install_carthage_dependencies 67 | 68 | #> Install extra tools (carting, swiftlint, swift-gen...) 69 | install_extras: 70 | pre_setup \ 71 | check_for_ruby \ 72 | check_for_homebrew \ 73 | update_homebrew \ 74 | install_carthage \ 75 | install_swift_lint 76 | 77 | pull_request: \ 78 | test \ 79 | codecov_upload \ 80 | danger 81 | 82 | pre_setup: 83 | $(info iOS project setup ...) 84 | 85 | check_for_ruby: 86 | $(info Checking for Ruby ...) 87 | 88 | ifeq ($(RUBY),) 89 | $(error Ruby is not installed) 90 | endif 91 | 92 | check_for_homebrew: 93 | $(info Checking for Homebrew ...) 94 | 95 | ifeq ($(HOMEBREW),) 96 | $(error Homebrew is not installed) 97 | endif 98 | 99 | update_homebrew: 100 | $(info Update Homebrew ...) 101 | 102 | brew update 103 | 104 | install_swift_lint: 105 | $(info Install swiftlint ...) 106 | 107 | ifneq ($(SWIFTLINT),) 108 | brew install swiftlint 109 | else 110 | $(info Already have, skipping.) 111 | endif 112 | 113 | install_bundler_gem: 114 | $(info Checking and install bundler ...) 115 | 116 | ifeq ($(BUNDLER),) 117 | gem install bundler -v '~> 1.17' 118 | else 119 | gem update bundler '~> 1.17' 120 | endif 121 | 122 | install_ruby_gems: 123 | $(info Install Ruby Gems ...) 124 | 125 | bundle check || bundle install 126 | 127 | install_carthage: 128 | $(info Install Carthage ...) 129 | 130 | ifneq ($(CARTHAGE),) 131 | brew install carthage 132 | else 133 | $(info Already have, skipping.) 134 | endif 135 | 136 | install_swiftgen: 137 | $(info Install Swift-Gen (https://github.com/SwiftGen/SwiftGen) ...) 138 | 139 | ifneq ($(SWIFTGEN),) 140 | brew install swiftgen 141 | else 142 | $(info Already have, skipping.) 143 | endif 144 | 145 | gitpull: 146 | $(info Pulling new commits ...) 147 | 148 | git pull 149 | 150 | #> -- QA Task Runners -- 151 | 152 | 153 | #> Danger a GitHub PR Locally. Useage `make danger_pr PR={PR#} autocorrect 154 | 155 | codecov_upload: 156 | curl -s https://codecov.io/bash | bash 157 | 158 | #> Danger a GitHub PR Locally. Useage `make danger_pr PR={PR#} autocorrect 159 | danger_pr: 160 | bundle exec danger pr "$(GITHUB_URL:/=)/pull/$(PULL)" 161 | 162 | danger: 163 | bundle exec danger 164 | 165 | #> SwiftLint autocorrect 166 | autocorrect: 167 | bundle exec swiftlint autocorrect --config .swiftlint.yml 168 | 169 | ## -- Testing -- 170 | 171 | #> Run test on all targets 172 | test: 173 | xcodebuild test -scheme $(TEST_SCHEME) -workspace $(WORKSPACE) -destination $(DESTINATION) -parallelizeTargets -showBuildTimingSummary -enableThreadSanitizer YES CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=YES | tee xcodebuild.log | xcpretty 174 | 175 | #> -- Building -- 176 | 177 | #> Make a .zip package of frameworks 178 | package: 179 | carthage build --no-skip-current --platform $(PLATFORM) --use-xcframeworks 180 | carthage archive $(MODULE_NAME) 181 | 182 | #> tag and release to github 183 | release: | _var_VERSION 184 | @if ! git diff --quiet HEAD; then \ 185 | ( $(call _error,refusing to release with uncommitted changes) ; exit 1 ); \ 186 | fi 187 | test 188 | package 189 | make --no-print-directory _tag VERSION=$(VERSION) 190 | make --no-print-directory _push VERSION=$(VERSION) 191 | 192 | #> Open the workspace 193 | open: 194 | open $(WORKSPACE) 195 | 196 | #> Setup the project, git-hooks etc 197 | init: 198 | git config core.hooksPath .githooks 199 | 200 | -------------------------------------------------------------------------------- /.makefiles/ludicrous.mk: -------------------------------------------------------------------------------- 1 | # The "main" utility functions and helpers useful for the common case. Most 2 | # ludicrous makefiles require this file, so it's sensible to `include` it first. 3 | INCLUDES_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST)))) 4 | 5 | LUDICROUS_BRANCH := master 6 | LUDICROUS_DOWNLOAD_URL := https://raw.githubusercontent.com/martinwalsh/ludicrous-makefiles/$(LUDICROUS_BRANCH)/includes 7 | 8 | # Generates help text from specialized comments (lines prefixed with a `#>`). 9 | # Free-standing comments are included in the prologue of the help text, while 10 | # those immediately preceding a recipe will be displayed along with their 11 | # respective target names 12 | # 13 | # Targets: help 14 | # Requires: awk 15 | # Side effects: 16 | # * .DEFAULT_GOAL is set to to the `help` target from this file 17 | # 18 | HELP_PROGRAM := $(INCLUDES_DIR)/help.awk 19 | 20 | # COLORS 21 | GREEN := $(shell tput -Txterm setaf 2) 22 | YELLOW := $(shell tput -Txterm setaf 3) 23 | WHITE := $(shell tput -Txterm setaf 7) 24 | RESET := $(shell tput -Txterm sgr0) 25 | 26 | #> displays this message 27 | # help: _HELP_F := $(firstword $(MAKEFILE_LIST)) 28 | # help: | _program_awk 29 | # @awk -f $(HELP_PROGRAM) $(wordlist 2,$(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) $(_HELP_F) # always prefer help from the top-level makefile 30 | TARGET_MAX_CHAR_NUM=20 31 | #> Show help 32 | help: 33 | @echo '' 34 | @echo 'Usage:' 35 | @echo ' ${YELLOW}make${RESET} ${GREEN}${RESET}' 36 | @echo '' 37 | @echo 'Targets:' 38 | @awk '/^[a-zA-Z\-\0-9]+:/ { \ 39 | helpMessage = match(lastLine, /^#> (.*)/); \ 40 | if (helpMessage) { \ 41 | helpCommand = substr($$1, 0, index($$1, ":")-1); \ 42 | helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \ 43 | printf " ${YELLOW}%-$(TARGET_MAX_CHAR_NUM)s${RESET} ${GREEN}%s${RESET}\n", helpCommand, helpMessage; \ 44 | } \ 45 | } \ 46 | { lastLine = $$0 }' \ 47 | $(MAKEFILE_LIST) 48 | 49 | .PHONY: help 50 | .DEFAULT_GOAL := help 51 | 52 | # Helper target for declaring an external executable as a recipe dependency. 53 | # For example, 54 | # `my_target: | _program_awk` 55 | # will fail before running the target named `my_target` if the command `awk` is 56 | # not found on the system path. 57 | _program_%: FORCE 58 | @_=$(or $(shell which $* 2> /dev/null),$(error `$*` command not found. Please install `$*` and try again)) 59 | 60 | # Helper target for declaring required environment variables. 61 | # 62 | # For example, 63 | # `my_target`: | _var_PARAMETER` 64 | # 65 | # will fail before running `my_target` if the variable `PARAMETER` is not declared. 66 | _var_%: FORCE 67 | @_=$(or $($*),$(error `$*` is a required parameter)) 68 | 69 | # The defult build dir, if we have only one it'll be easier to cleanup 70 | BUILD_DIR =: build 71 | 72 | $(BUILD_DIR): 73 | mkdir -p $@ 74 | 75 | # text manipulation helpers 76 | _awk_case = $(shell echo | awk '{ print $(1)("$(2)") }') 77 | lc = $(call _awk_case,tolower,$(1)) 78 | uc = $(call _awk_case,toupper,$(1)) 79 | 80 | # Useful for forcing targets to build when .PHONY doesn't help 81 | FORCE: 82 | .PHONY: FORCE 83 | 84 | # Provides two callables, `log` and `_log`, to facilitate consistent 85 | # user-defined output, formatted using tput when available. 86 | # 87 | # Override TPUT_PREFIX to alter the formatting. 88 | TPUT := $(shell which tput 2> /dev/null) 89 | TPUT_PREFIX := $(TPUT) bold 90 | TPUT_SUFFIX := $(TPUT) sgr0 91 | TPUT_RED := $(TPUT) setaf 1 92 | TPUT_GREEN := $(TPUT) setaf 2 93 | TPUT_YELLOW := $(TPUT) setaf 3 94 | LOG_PREFIX ?= ===> 95 | 96 | ifeq (,$(and $(TPUT),$(TERM))) 97 | 98 | define _log 99 | echo "$(if $(LOG_PREFIX),$(LOG_PREFIX) )$(1)" 100 | endef 101 | 102 | define _warn 103 | echo "$(if $(LOG_PREFIX),$(LOG_PREFIX) )$(1)" 104 | endef 105 | 106 | define _error 107 | echo "$(if $(LOG_PREFIX),$(LOG_PREFIX) )$(1)" 108 | endef 109 | 110 | else 111 | 112 | define _log 113 | $(TPUT_PREFIX); echo "$(if $(LOG_PREFIX),$(LOG_PREFIX) )$(1)"; $(TPUT_SUFFIX) 114 | endef 115 | 116 | define _warn 117 | $(TPUT_PREFIX); $(TPUT_YELLOW); echo "$(if $(LOG_PREFIX),$(LOG_PREFIX) )$(1)"; $(TPUT_SUFFIX) 118 | endef 119 | 120 | define _error 121 | $(TPUT_PREFIX); $(TPUT_RED); echo "$(if $(LOG_PREFIX),$(LOG_PREFIX) )$(1)"; $(TPUT_SUFFIX) 122 | endef 123 | 124 | endif 125 | 126 | define log 127 | @$(_log) 128 | endef 129 | 130 | # Removes build artifacts, implement with your own `clean::` target to remove additional artifacts. 131 | # See https://www.gnu.org/software/make/manual/make.html#Double_002dColon for more information. 132 | #> removes build artifacts 133 | clean:: 134 | @: 135 | .PHONY: clean 136 | 137 | # Provides callables `download` and `download_to`. 138 | # * `download`: fetches a url `$(1)` piping it to a command specified in `$(2)`. 139 | # Usage: `$(call download,$(URL),tar -xf - -C /tmp/dest)` 140 | # 141 | # * `download_to`: fetches a url `$(1)` and writes it to a local path specified in `$(2)`. 142 | # Usage: `$(call download_to,$(URL),/tmp/dest)` 143 | # 144 | # Requires: curl 145 | # 146 | # Additional command line parameters may be passed to curl via CURL_OPTS. 147 | # For example, `CURL_OPTS += -s`. 148 | # 149 | CURL_OPTS ?= --location --silent 150 | 151 | ifneq ($(shell which curl 2> /dev/null),) 152 | DOWNLOADER = curl $(CURL_OPTS) 153 | DOWNLOAD_FLAGS := 154 | DOWNLOAD_TO_FLAGS := --write-out "%{http_code}" -o 155 | else 156 | NO_DOWNLOADER_FOUND := Unable to locate a suitable download utility (curl) 157 | endif 158 | 159 | define download 160 | $(if $(NO_DOWNLOADER_FOUND),$(error $(NO_DOWNLOADER_FOUND)),$(DOWNLOADER) $(DOWNLOAD_FLAGS) "$(1)" | $(2)) 161 | endef 162 | 163 | define download_to 164 | $(if $(NO_DOWNLOADER_FOUND),$(error $(NO_DOWNLOADER_FOUND)),$(DOWNLOADER) $(DOWNLOAD_TO_FLAGS) $(2) "$(1)") 165 | endef 166 | 167 | # Provides variables useful for determining the operating system we're running 168 | # on. 169 | # 170 | # OS_NAME will reflect the name of the operating system: Darwin, Linux or Windows 171 | # OS_CPU will be either x86 (32bit) or amd64 (64bit) 172 | # OS_ARCH will be either i686 (32bit) or x86_64 (64bit) 173 | # 174 | ifeq (Windows_NT,$(OS)) 175 | OS_NAME := Windows 176 | OS_CPU := $(call _lower,$(PROCESSOR_ARCHITECTURE)) 177 | OS_ARCH := $(if $(findstring amd64,$(OS_CPU)),x86_64,i686) 178 | else 179 | OS_NAME := $(shell uname -s) 180 | OS_ARCH := $(shell uname -m) 181 | OS_CPU := $(if $(findstring 64,$(OS_ARCH)),amd64,x86) 182 | endif 183 | 184 | # Install ludicrous plugins by include directive 185 | PLUGIN_TARGETS := $(abspath $(INCLUDES_DIR)/%.mk) $(subst $(CURDIR)/,,$(abspath $(INCLUDES_DIR)/%.mk)) 186 | 187 | ifneq (B,$(findstring B,$(MAKEFLAGS))) 188 | $(PLUGIN_TARGETS): 189 | @[ ! -f $@ ] && \ 190 | ( \ 191 | $(call _log,downloading ludicrous plugin to $@); \ 192 | STATUS="$$($(call download_to,$(LUDICROUS_DOWNLOAD_URL)/$(notdir $@),$@))"; \ 193 | if [ $$STATUS -ne 200 ]; then $(call _error,ludicrous plugin $(notdir $@) not found.); exit 1; fi \ 194 | ) 195 | else 196 | $(PLUGIN_TARGETS): 197 | @: 198 | endif 199 | -------------------------------------------------------------------------------- /.swiftlint.yml: -------------------------------------------------------------------------------- 1 | disabled_rules: # rule identifiers to exclude from running 2 | - missing_docs 3 | - unused_closure_parameter 4 | - identifier_name 5 | - weak_delegate 6 | - cyclomatic_complexity 7 | - function_body_length 8 | - todo 9 | - large_tuple 10 | 11 | opt_in_rules: # some rules are only opt-in 12 | - empty_count 13 | # Find all the available rules by running: 14 | # swiftlint rules 15 | 16 | included: # paths to include during linting. `--path` is ignored if present. 17 | - Sources 18 | - Tests 19 | - RxReachability-Example 20 | excluded: # paths to ignore during linting. Takes precedence over `included`. 21 | - Carthage 22 | - Pods 23 | - RxReachability-Example/Pods 24 | - RxReachability-Example/Carthage 25 | 26 | 27 | # configurable rules can be customized from this configuration file 28 | # binary rules can set their severity level 29 | force_cast: warning # implicitly 30 | force_try: 31 | severity: warning # explicitly 32 | 33 | # rules that have both warning and error levels, can set just the warning level 34 | # implicitly 35 | line_length: 500 36 | 37 | # they can set both implicitly with an array 38 | type_body_length: 39 | - 300 # warning 40 | - 400 # error 41 | 42 | # or they can set both explicitly 43 | file_length: 44 | warning: 600 45 | error: 1200 46 | 47 | # naming rules can set warnings/errors for min_length and max_length 48 | # additionally they can set excluded names 49 | type_name: 50 | min_length: 3 # only warning 51 | max_length: # warning and error 52 | warning: 40 53 | error: 50 54 | excluded: # excluded via string 55 | - T 56 | - t 57 | 58 | identifier_name: 59 | min_length: # only min_length 60 | error: 3 # only error 61 | excluded: # excluded via string array 62 | - id 63 | - vc 64 | - to 65 | - a 66 | - b 67 | - t 68 | - x 69 | - y 70 | - z 71 | - p 72 | - xy 73 | - dx 74 | - dy 75 | - gr 76 | -------------------------------------------------------------------------------- /.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # references: 2 | # * https://www.objc.io/issues/6-build-tools/travis-ci/ 3 | # * https://github.com/supermarin/xcpretty#usage 4 | 5 | os: osx 6 | osx_image: xcode12.2 7 | language: objective-c 8 | 9 | before_install: 10 | - brew install swiftlint 11 | - brew install cocoapods 12 | - pod repo update 13 | 14 | script: 15 | - swiftlint 16 | - make pod_lint 17 | -------------------------------------------------------------------------------- /Assets/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RxSwiftCommunity/RxReachability/96c07f7cc596ac6651c5628b0e7c0d776c99d8da/Assets/Logo.png -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # CHANGELOG 2 | 3 | The changelog for `RxReachability`. Also see the [releases](https://github.com/RxSwiftCommunity/RxReachability/releases) on GitHub. 4 | 5 | -------------------------------------- 6 | ## [1.2.1](https://github.com/RxSwiftCommunity/RxReachability/releases/tag/1.2.1) 7 | 8 | ### Added 9 | 10 | - closes #33 Jazzy Docs https://RxSwiftCommunity.gitub.io/RxReachability/ 11 | - closes #34 Added Swift PM unit tests 12 | - Added this CHANGELOG.md 13 | 14 | ### Changed 15 | 16 | ### Fixed 17 | 18 | - closes #45 Fixes Swift PM 19 | 20 | ## [1.2.0](https://github.com/RxSwiftCommunity/RxReachability/releases/tag/1.2.0) 21 | 22 | ### Added 23 | 24 | - Swift PM support 25 | 26 | ### Changed 27 | 28 | - Update to RxSwift 6 29 | 30 | ## [1.1.0](https://github.com/RxSwiftCommunity/RxReachability/releases/tag/1.1.0) 31 | 32 | ### Added 33 | 34 | ### Changed 35 | 36 | - Swift 5 37 | -------------------------------------------------------------------------------- /Cartfile: -------------------------------------------------------------------------------- 1 | github "ashleymills/Reachability.swift" ~> 5.1 2 | github "ReactiveX/RxSwift" ~> 6.1.0 3 | -------------------------------------------------------------------------------- /Cartfile.resolved: -------------------------------------------------------------------------------- 1 | github "ReactiveX/RxSwift" "6.5.0" 2 | github "ashleymills/Reachability.swift" "v5.1.0" 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 RxSwift Community 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | GITHUB_URL := https://github.com/RxSwiftCommunity/RxReachability/ 2 | 3 | include .makefiles/ludicrous.mk 4 | include .makefiles/bundler.mk 5 | include .makefiles/ios.mk 6 | 7 | PLATFORM := 'iOS' 8 | TEST_SCHEME := 'RxReachability' 9 | WORKSPACE := 'RxReachability-Example/RxReachability_Example.xcworkspace' 10 | DESTINATION := 'platform=iOS Simulator,OS=14.4,name=iPhone 12' 11 | 12 | %: 13 | @: 14 | 15 | args = `arg="$(filter-out $@,$(MAKECMDGOALS))" && echo $${arg:-${1}}` 16 | 17 | #> Lint the podspec for upload 18 | pod_lint: 19 | @pod spec lint RxReachability.podspec \ 20 | --fail-fast \ 21 | --no-clean 22 | 23 | #> Publish a podspec to Podspec repo 24 | pod_publish: 25 | @pod repo push RxReachability.podspec \ 26 | --private \ 27 | --skip-tests \ 28 | --allow-warnings 29 | 30 | #> Build API documentation; https://github.com/realm/jazzy 31 | jazzy: 32 | @jazzy 33 | 34 | #> Markdown API using sourcedocs; https://github.com/eneko/SourceDocs 35 | sourcedocs: 36 | @sourcedocs generate \ 37 | --module-name RxReachability \ 38 | --output-folder 'docs/reference' \ 39 | --collapsible \ 40 | --table-of-contents \ 41 | --spm-module RxReachability 42 | 43 | #> Generate linux unit tests 44 | spm-linuxmain: 45 | swift test --generate-linuxmain 46 | 47 | #> Generate docs using sourcedocs through swift pm 48 | spm-docs: 49 | swift run sourcedocs generate --clean --spm-module RxReachability --output-folder docs/reference --module-name-path 50 | 51 | #> Build via Swift PM 52 | spm-build: 53 | swift build --disable-sandbox -c release 54 | 55 | #> Public cocoapod spec 56 | public-pod: 57 | pod trunk register rxwebkit@rxswift.org "RxWebKit Maintainers" 58 | pod trunk push RxReachability 59 | -------------------------------------------------------------------------------- /Package.resolved: -------------------------------------------------------------------------------- 1 | { 2 | "object": { 3 | "pins": [ 4 | { 5 | "package": "Reachability", 6 | "repositoryURL": "https://github.com/ashleymills/Reachability.swift", 7 | "state": { 8 | "branch": null, 9 | "revision": "c01bbdf2d633cf049ae1ed1a68a2020a8bda32e2", 10 | "version": "5.1.0" 11 | } 12 | }, 13 | { 14 | "package": "RxSwift", 15 | "repositoryURL": "https://github.com/ReactiveX/RxSwift", 16 | "state": { 17 | "branch": null, 18 | "revision": "b4307ba0b6425c0ba4178e138799946c3da594f8", 19 | "version": "6.5.0" 20 | } 21 | } 22 | ] 23 | }, 24 | "version": 1 25 | } 26 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.2 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "RxReachability", 8 | platforms: [ 9 | .macOS(.v10_10), 10 | .iOS(.v11), 11 | .tvOS(.v11) 12 | ], 13 | products: [ 14 | .library( 15 | name: "RxReachability", 16 | targets: ["RxReachability"]) 17 | ], 18 | dependencies: [ 19 | .package(url: "https://github.com/ReactiveX/RxSwift", .upToNextMajor(from: "6.0.0")), 20 | .package( 21 | name: "Reachability", 22 | url: "https://github.com/ashleymills/Reachability.swift", 23 | .upToNextMajor(from: "5.1.0") 24 | ) 25 | ], 26 | targets: [ 27 | .target( 28 | name: "RxReachability", 29 | dependencies: [ 30 | "RxSwift", "Reachability", 31 | .product(name: "RxCocoa", package: "RxSwift") 32 | ]), 33 | 34 | // MARK: SwiftPM tests 35 | .testTarget( 36 | name: "RxReachabilityTests", 37 | dependencies: [ 38 | "RxReachability", 39 | .product(name: "RxBlocking", package: "RxSwift") 40 | ]), 41 | ] 42 | ) 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Logo](https://raw.githubusercontent.com/RxSwiftCommunity/RxReachability/master/Assets/Logo.png) 2 | 3 | RxReachability 4 | ========= 5 | [![GitHub release](https://img.shields.io/github/release/RxSwiftCommunity/rxreachability.svg)](https://github.com/RxSwiftCommunity/rxreachability/releases) 6 | [![Version](https://img.shields.io/cocoapods/v/RxReachability.svg?style=flat)](http://cocoapods.org/pods/RxReachability) 7 | [![License](https://img.shields.io/cocoapods/l/RxReachability.svg?style=flat)](http://cocoapods.org/pods/RxReachability) 8 | [![Platform](https://img.shields.io/cocoapods/p/RxReachability.svg?style=flat)](http://cocoapods.org/pods/RxReachability) 9 | [![Build Status](https://travis-ci.org/RxSwiftCommunity/RxReachability.svg?branch=master)](https://travis-ci.org/RxSwiftCommunity/RxReachability) 10 | ![Test Coverage](https://raw.githubusercontent.com/RxSwiftCommunity/RxReachability/master/docs/badge.svg) 11 | 12 | RxReachability adds easy to use RxSwift bindings for [ReachabilitySwift](https://github.com/ashleymills/Reachability.swift). 13 | You can react to network reachability changes and even retry observables when network comes back up. 14 | 15 | ## Available APIs 16 | 17 | RxReachability adds the following RxSwift bindings: 18 | 19 | - `reachabilityChanged: Observable` 20 | - `status: Observable` 21 | - `isReachable: Observable` 22 | - `isConnected: Observable` 23 | - `isDisconnected: Observable` 24 | 25 | ## Common Usage 26 | 27 | #### 1. Be sure to store an instance of `Reachability` in your `ViewController` or similar, and start/stop the notifier on `viewWillAppear` and `viewWillDisappear` methods. 28 | 29 | ```swift 30 | class ViewController: UIViewController { 31 | 32 | let disposeBag = DisposeBag() 33 | var reachability: Reachability? 34 | 35 | override func viewDidLoad() { 36 | super.viewDidLoad() 37 | reachability = Reachability() 38 | } 39 | 40 | override func viewWillAppear(_ animated: Bool) { 41 | super.viewWillAppear(animated) 42 | try? reachability?.startNotifier() 43 | } 44 | 45 | override func viewWillDisappear(_ animated: Bool) { 46 | super.viewWillDisappear(animated) 47 | reachability?.stopNotifier() 48 | } 49 | } 50 | 51 | ``` 52 | 53 | #### 2. Subscribe to any of the bindings to know when a change happens. 54 | 55 | ```swift 56 | extension ViewController { 57 | 58 | let disposeBag = DisposeBag() 59 | 60 | func bindReachability() { 61 | 62 | reachability?.rx.reachabilityChanged 63 | .subscribe(onNext: { reachability: Reachability in 64 | print("Reachability changed: \(reachability.currentReachabilityStatus)") 65 | }) 66 | .disposed(by: disposeBag) 67 | 68 | reachability?.rx.status 69 | .subscribe(onNext: { status: Reachability.NetworkStatus in 70 | print("Reachability status changed: \(status)") 71 | }) 72 | .disposed(by: disposeBag) 73 | 74 | reachability?.rx.isReachable 75 | .subscribe(onNext: { isReachable: Bool in 76 | print("Is reachable: \(isReachable)") 77 | }) 78 | .disposed(by: disposeBag) 79 | 80 | reachability?.rx.isConnected 81 | .subscribe(onNext: { 82 | print("Is connected") 83 | }) 84 | .disposed(by: disposeBag) 85 | 86 | reachability?.rx.isDisconnected 87 | .subscribe(onNext: { 88 | print("Is disconnected") 89 | }) 90 | .disposed(by: disposeBag) 91 | } 92 | ``` 93 | 94 | ## Static Usage 95 | 96 | #### 1. Be sure to store an instance of `Reachability` somewhere on your `AppDelegate` or similar, and start the notifier. 97 | 98 | ```swift 99 | import Reachability 100 | 101 | @UIApplicationMain 102 | class AppDelegate: UIResponder, UIApplicationDelegate { 103 | 104 | var reachability: Reachability? 105 | 106 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 107 | reachability = Reachability() 108 | try? reachability?.startNotifier() 109 | return true 110 | } 111 | } 112 | 113 | ``` 114 | 115 | #### 2. Subscribe to any of the bindings to know when a change happens. 116 | 117 | ```swift 118 | import Reachability 119 | import RxReachability 120 | import RxSwift 121 | 122 | class ViewController: UIViewController { 123 | 124 | let disposeBag = DisposeBag() 125 | 126 | override func viewDidLoad() { 127 | super.viewDidLoad() 128 | 129 | Reachability.rx.reachabilityChanged 130 | .subscribe(onNext: { reachability: Reachability in 131 | print("Reachability changed: \(reachability.currrentReachabilityStatus)") 132 | }) 133 | .disposed(by: disposeBag) 134 | 135 | Reachability.rx.status 136 | .subscribe(onNext: { status: Reachability.NetworkStatus in 137 | print("Reachability status changed: \(status)") 138 | }) 139 | .disposed(by: disposeBag) 140 | 141 | Reachability.rx.isReachable 142 | .subscribe(onNext: { isReachable: Bool in 143 | print("Is reachable: \(isReachable)") 144 | }) 145 | .disposed(by: disposeBag) 146 | 147 | Reachability.rx.isConnected 148 | .subscribe(onNext: { 149 | print("Is connected") 150 | }) 151 | .disposed(by: disposeBag) 152 | 153 | Reachability.rx.isDisconnected 154 | .subscribe(onNext: { 155 | print("Is disconnected") 156 | }) 157 | .disposed(by: disposeBag) 158 | } 159 | ``` 160 | 161 | ## Advanced Usage 162 | 163 | With RxReachability you can also add a retry when network comes back up with a given timeout. 164 | This does require you to have a stored instance of Reachability though. 165 | 166 | ```swift 167 | func request(somethingId: Int) -> Observable { 168 | return network.request(.something(somethingId)) 169 | .retryOnConnect(timeout: 30) 170 | .map { Something(JSON: $0) } 171 | } 172 | ``` 173 | 174 | ## Installation 175 | 176 | ### Installation via CocoaPods 177 | 178 | To integrate RxReachability into your Xcode project using CocoaPods, simply add the following line to your `Podfile`: 179 | 180 | ```ruby 181 | pod 'RxReachability', '~> 1.2.1' 182 | ``` 183 | 184 | ### Installation via Carthage 185 | 186 | To integrate RxReachability into your Xcode project using CocoaPods, simply add the following line to your `Cartfile`: 187 | 188 | ```ruby 189 | github "RxSwiftCommunity/RxReachability" ~> 1.2.1 190 | ``` 191 | 192 | ### Installation via Swift Package Manager (SPM) 193 | 194 | To integrate RxReachability into your Xcode project using SPM, simply add the following line to your `Package.swift`: 195 | 196 | ```swift 197 | .package(url: "https://github.com/RxSwiftCommunity/RxReachability", .upToNextMajor(from: "1.2.1")), 198 | ``` 199 | 200 | ## Example 201 | 202 | To run the example project, clone the repo, and run `pod install` from the Example directory first. 203 | 204 | ## License 205 | 206 | This library belongs to _RxSwiftCommunity_. 207 | 208 | RxReachability is available under the MIT license. See the LICENSE file for more info. 209 | -------------------------------------------------------------------------------- /RxReachability-Example/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | platform :ios, '11.0' 3 | 4 | target 'RxReachability_Example' do 5 | # Comment the next line if you don't want to use dynamic frameworks 6 | use_frameworks! 7 | 8 | # Pods for RxReachability 9 | pod "RxReachability", :path => '../' 10 | 11 | end 12 | -------------------------------------------------------------------------------- /RxReachability-Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - ReachabilitySwift (5.0.0) 3 | - RxCocoa (6.5.0): 4 | - RxRelay (= 6.5.0) 5 | - RxSwift (= 6.5.0) 6 | - RxReachability (1.2.1): 7 | - ReachabilitySwift (< 6.0, >= 5.0) 8 | - RxCocoa (~> 6) 9 | - RxSwift (~> 6) 10 | - RxRelay (6.5.0): 11 | - RxSwift (= 6.5.0) 12 | - RxSwift (6.5.0) 13 | 14 | DEPENDENCIES: 15 | - RxReachability (from `../`) 16 | 17 | SPEC REPOS: 18 | trunk: 19 | - ReachabilitySwift 20 | - RxCocoa 21 | - RxRelay 22 | - RxSwift 23 | 24 | EXTERNAL SOURCES: 25 | RxReachability: 26 | :path: "../" 27 | 28 | SPEC CHECKSUMS: 29 | ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 30 | RxCocoa: 94f817b71c07517321eb4f9ad299112ca8af743b 31 | RxReachability: 278afb9aa52ead3f1e8931626181cfe9a4872141 32 | RxRelay: 1de1523e604c72b6c68feadedd1af3b1b4d0ecbd 33 | RxSwift: 5710a9e6b17f3c3d6e40d6e559b9fa1e813b2ef8 34 | 35 | PODFILE CHECKSUM: dc58bb4cb9071270b5e2c825dde8957d03945c64 36 | 37 | COCOAPODS: 1.11.3 38 | -------------------------------------------------------------------------------- /RxReachability-Example/RxReachability/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // RxReachability 4 | // 5 | // Created by ivanbruel on 03/22/2017. 6 | // Copyright (c) RxSwiftCommunity. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | func applicationWillResignActive(_ application: UIApplication) { 22 | // Sent when the application is about to move from active to inactive state. 23 | // This can occur for certain types of temporary interruptions (such as an 24 | // incoming phone call or SMS message) or when the user quits the application 25 | // and it begins the transition to the background state. 26 | // Use this method to pause ongoing tasks, disable timers, and throttle down 27 | // OpenGL ES frame rates. Games should use this method to pause the game. 28 | } 29 | 30 | func applicationDidEnterBackground(_ application: UIApplication) { 31 | // Use this method to release shared resources, save user data, invalidate timers, 32 | // and store enough application state information to restore your application to 33 | // its current state in case it is terminated later. 34 | // If your application supports background execution, this method is called instead 35 | // of applicationWillTerminate: when the user quits. 36 | } 37 | 38 | func applicationWillEnterForeground(_ application: UIApplication) { 39 | // Called as part of the transition from the background to the inactive state; 40 | // here you can undo many of the changes made on entering the background. 41 | } 42 | 43 | func applicationDidBecomeActive(_ application: UIApplication) { 44 | // Restart any tasks that were paused (or not yet started) while the application was inactive. 45 | // If the application was previously in the background, optionally refresh the user interface. 46 | } 47 | 48 | func applicationWillTerminate(_ application: UIApplication) { 49 | // Called when the application is about to terminate. 50 | // Save data if appropriate. 51 | // See also applicationDidEnterBackground:. 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /RxReachability-Example/RxReachability/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "scale" : "1x", 46 | "size" : "20x20" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "scale" : "2x", 51 | "size" : "20x20" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "scale" : "1x", 56 | "size" : "29x29" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "29x29" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "scale" : "1x", 66 | "size" : "40x40" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "scale" : "2x", 71 | "size" : "40x40" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "scale" : "1x", 76 | "size" : "76x76" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "scale" : "2x", 81 | "size" : "76x76" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "scale" : "2x", 86 | "size" : "83.5x83.5" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "scale" : "1x", 91 | "size" : "1024x1024" 92 | } 93 | ], 94 | "info" : { 95 | "author" : "xcode", 96 | "version" : 1 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /RxReachability-Example/RxReachability/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /RxReachability-Example/RxReachability/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /RxReachability-Example/RxReachability/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /RxReachability-Example/RxReachability/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | $(PRODUCT_MODULE_NAME).SceneDelegate 36 | UISceneStoryboardFile 37 | Main 38 | 39 | 40 | 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIMainStoryboardFile 45 | Main 46 | UIRequiredDeviceCapabilities 47 | 48 | armv7 49 | 50 | UISupportedInterfaceOrientations 51 | 52 | UIInterfaceOrientationPortrait 53 | 54 | UISupportedInterfaceOrientations~ipad 55 | 56 | UIInterfaceOrientationPortrait 57 | UIInterfaceOrientationPortraitUpsideDown 58 | UIInterfaceOrientationLandscapeLeft 59 | UIInterfaceOrientationLandscapeRight 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /RxReachability-Example/RxReachability/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // RxReachability 4 | // 5 | // Created by ivanbruel on 03/22/2017. 6 | // Copyright (c) RxSwiftCommunity. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Reachability 11 | import RxSwift 12 | import RxCocoa 13 | import RxReachability 14 | 15 | class ViewController: UIViewController { 16 | 17 | @IBOutlet private weak var label: UILabel! 18 | 19 | let reachability: Reachability! = try? Reachability() 20 | let disposeBag = DisposeBag() 21 | 22 | override func viewDidLoad() { 23 | super.viewDidLoad() 24 | 25 | reachability.rx.isReachable 26 | .map { "Is reachable: \($0)" } 27 | .bind(to: label.rx.text) 28 | .disposed(by: disposeBag) 29 | } 30 | 31 | override func viewWillAppear(_ animated: Bool) { 32 | super.viewWillAppear(animated) 33 | try? reachability.startNotifier() 34 | } 35 | 36 | override func viewWillDisappear(_ animated: Bool) { 37 | super.viewWillDisappear(animated) 38 | reachability.stopNotifier() 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /RxReachability-Example/RxReachability_Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 51; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0CC2E74A24914D3200430B43 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CC2E74924914D3200430B43 /* AppDelegate.swift */; }; 11 | 0CC2E74E24914D3200430B43 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CC2E74D24914D3200430B43 /* ViewController.swift */; }; 12 | 0CC2E75124914D3200430B43 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0CC2E74F24914D3200430B43 /* Main.storyboard */; }; 13 | 0CC2E75324914D3300430B43 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0CC2E75224914D3300430B43 /* Assets.xcassets */; }; 14 | 0CC2E75624914D3300430B43 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0CC2E75424914D3300430B43 /* LaunchScreen.storyboard */; }; 15 | 5E9EC013AF7EA4DFC2FC9510 /* Pods_RxReachability_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E4773F0C6ADE5E9074850364 /* Pods_RxReachability_Example.framework */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | 0CC2E74624914D3200430B43 /* RxReachability_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RxReachability_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 20 | 0CC2E74924914D3200430B43 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 21 | 0CC2E74D24914D3200430B43 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 22 | 0CC2E75024914D3200430B43 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 23 | 0CC2E75224914D3300430B43 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 24 | 0CC2E75524914D3300430B43 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 25 | 0CC2E75724914D3300430B43 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 26 | 19FA38861B1E60886994A732 /* Pods-RxReachability.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxReachability.debug.xcconfig"; path = "Target Support Files/Pods-RxReachability/Pods-RxReachability.debug.xcconfig"; sourceTree = ""; }; 27 | 56A76D436C25C1A013CB9DE1 /* Pods-RxReachability_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxReachability_Example.release.xcconfig"; path = "Target Support Files/Pods-RxReachability_Example/Pods-RxReachability_Example.release.xcconfig"; sourceTree = ""; }; 28 | 6385654E3CB5167442094F27 /* Pods-RxReachability.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxReachability.release.xcconfig"; path = "Target Support Files/Pods-RxReachability/Pods-RxReachability.release.xcconfig"; sourceTree = ""; }; 29 | 968ADC5647A82A17737C9C15 /* Pods-RxReachability_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxReachability_Example.debug.xcconfig"; path = "Target Support Files/Pods-RxReachability_Example/Pods-RxReachability_Example.debug.xcconfig"; sourceTree = ""; }; 30 | E4773F0C6ADE5E9074850364 /* Pods_RxReachability_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RxReachability_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | /* End PBXFileReference section */ 32 | 33 | /* Begin PBXFrameworksBuildPhase section */ 34 | 0CC2E74324914D3200430B43 /* Frameworks */ = { 35 | isa = PBXFrameworksBuildPhase; 36 | buildActionMask = 2147483647; 37 | files = ( 38 | 5E9EC013AF7EA4DFC2FC9510 /* Pods_RxReachability_Example.framework in Frameworks */, 39 | ); 40 | runOnlyForDeploymentPostprocessing = 0; 41 | }; 42 | /* End PBXFrameworksBuildPhase section */ 43 | 44 | /* Begin PBXGroup section */ 45 | 0CC2E73D24914D3200430B43 = { 46 | isa = PBXGroup; 47 | children = ( 48 | 0CC2E74824914D3200430B43 /* RxReachability */, 49 | 0CC2E74724914D3200430B43 /* Products */, 50 | 37712D017C7E0D25DECEE9CE /* Pods */, 51 | 42B4D60E7FC148A238600C99 /* Frameworks */, 52 | ); 53 | sourceTree = ""; 54 | }; 55 | 0CC2E74724914D3200430B43 /* Products */ = { 56 | isa = PBXGroup; 57 | children = ( 58 | 0CC2E74624914D3200430B43 /* RxReachability_Example.app */, 59 | ); 60 | name = Products; 61 | sourceTree = ""; 62 | }; 63 | 0CC2E74824914D3200430B43 /* RxReachability */ = { 64 | isa = PBXGroup; 65 | children = ( 66 | 0CC2E74924914D3200430B43 /* AppDelegate.swift */, 67 | 0CC2E74D24914D3200430B43 /* ViewController.swift */, 68 | 0CC2E74F24914D3200430B43 /* Main.storyboard */, 69 | 0CC2E75224914D3300430B43 /* Assets.xcassets */, 70 | 0CC2E75424914D3300430B43 /* LaunchScreen.storyboard */, 71 | 0CC2E75724914D3300430B43 /* Info.plist */, 72 | ); 73 | path = RxReachability; 74 | sourceTree = ""; 75 | }; 76 | 37712D017C7E0D25DECEE9CE /* Pods */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | 19FA38861B1E60886994A732 /* Pods-RxReachability.debug.xcconfig */, 80 | 6385654E3CB5167442094F27 /* Pods-RxReachability.release.xcconfig */, 81 | 968ADC5647A82A17737C9C15 /* Pods-RxReachability_Example.debug.xcconfig */, 82 | 56A76D436C25C1A013CB9DE1 /* Pods-RxReachability_Example.release.xcconfig */, 83 | ); 84 | path = Pods; 85 | sourceTree = ""; 86 | }; 87 | 42B4D60E7FC148A238600C99 /* Frameworks */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | E4773F0C6ADE5E9074850364 /* Pods_RxReachability_Example.framework */, 91 | ); 92 | name = Frameworks; 93 | sourceTree = ""; 94 | }; 95 | /* End PBXGroup section */ 96 | 97 | /* Begin PBXNativeTarget section */ 98 | 0CC2E74524914D3200430B43 /* RxReachability_Example */ = { 99 | isa = PBXNativeTarget; 100 | buildConfigurationList = 0CC2E75A24914D3300430B43 /* Build configuration list for PBXNativeTarget "RxReachability_Example" */; 101 | buildPhases = ( 102 | 71E8F6F43C0DD6F319B83B48 /* [CP] Check Pods Manifest.lock */, 103 | 0CC2E74224914D3200430B43 /* Sources */, 104 | 0CC2E74324914D3200430B43 /* Frameworks */, 105 | 0CC2E74424914D3200430B43 /* Resources */, 106 | 25DB544DA4F1421DC1C4433D /* [CP] Embed Pods Frameworks */, 107 | ); 108 | buildRules = ( 109 | ); 110 | dependencies = ( 111 | ); 112 | name = RxReachability_Example; 113 | productName = RxReachability; 114 | productReference = 0CC2E74624914D3200430B43 /* RxReachability_Example.app */; 115 | productType = "com.apple.product-type.application"; 116 | }; 117 | /* End PBXNativeTarget section */ 118 | 119 | /* Begin PBXProject section */ 120 | 0CC2E73E24914D3200430B43 /* Project object */ = { 121 | isa = PBXProject; 122 | attributes = { 123 | LastSwiftUpdateCheck = 1150; 124 | LastUpgradeCheck = 1240; 125 | ORGANIZATIONNAME = CocoaPods; 126 | TargetAttributes = { 127 | 0CC2E74524914D3200430B43 = { 128 | CreatedOnToolsVersion = 11.5; 129 | }; 130 | }; 131 | }; 132 | buildConfigurationList = 0CC2E74124914D3200430B43 /* Build configuration list for PBXProject "RxReachability_Example" */; 133 | compatibilityVersion = "Xcode 9.3"; 134 | developmentRegion = en; 135 | hasScannedForEncodings = 0; 136 | knownRegions = ( 137 | en, 138 | Base, 139 | ); 140 | mainGroup = 0CC2E73D24914D3200430B43; 141 | productRefGroup = 0CC2E74724914D3200430B43 /* Products */; 142 | projectDirPath = ""; 143 | projectRoot = ""; 144 | targets = ( 145 | 0CC2E74524914D3200430B43 /* RxReachability_Example */, 146 | ); 147 | }; 148 | /* End PBXProject section */ 149 | 150 | /* Begin PBXResourcesBuildPhase section */ 151 | 0CC2E74424914D3200430B43 /* Resources */ = { 152 | isa = PBXResourcesBuildPhase; 153 | buildActionMask = 2147483647; 154 | files = ( 155 | 0CC2E75624914D3300430B43 /* LaunchScreen.storyboard in Resources */, 156 | 0CC2E75324914D3300430B43 /* Assets.xcassets in Resources */, 157 | 0CC2E75124914D3200430B43 /* Main.storyboard in Resources */, 158 | ); 159 | runOnlyForDeploymentPostprocessing = 0; 160 | }; 161 | /* End PBXResourcesBuildPhase section */ 162 | 163 | /* Begin PBXShellScriptBuildPhase section */ 164 | 25DB544DA4F1421DC1C4433D /* [CP] Embed Pods Frameworks */ = { 165 | isa = PBXShellScriptBuildPhase; 166 | buildActionMask = 2147483647; 167 | files = ( 168 | ); 169 | inputFileListPaths = ( 170 | "${PODS_ROOT}/Target Support Files/Pods-RxReachability_Example/Pods-RxReachability_Example-frameworks-${CONFIGURATION}-input-files.xcfilelist", 171 | ); 172 | name = "[CP] Embed Pods Frameworks"; 173 | outputFileListPaths = ( 174 | "${PODS_ROOT}/Target Support Files/Pods-RxReachability_Example/Pods-RxReachability_Example-frameworks-${CONFIGURATION}-output-files.xcfilelist", 175 | ); 176 | runOnlyForDeploymentPostprocessing = 0; 177 | shellPath = /bin/sh; 178 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RxReachability_Example/Pods-RxReachability_Example-frameworks.sh\"\n"; 179 | showEnvVarsInLog = 0; 180 | }; 181 | 71E8F6F43C0DD6F319B83B48 /* [CP] Check Pods Manifest.lock */ = { 182 | isa = PBXShellScriptBuildPhase; 183 | buildActionMask = 2147483647; 184 | files = ( 185 | ); 186 | inputFileListPaths = ( 187 | ); 188 | inputPaths = ( 189 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 190 | "${PODS_ROOT}/Manifest.lock", 191 | ); 192 | name = "[CP] Check Pods Manifest.lock"; 193 | outputFileListPaths = ( 194 | ); 195 | outputPaths = ( 196 | "$(DERIVED_FILE_DIR)/Pods-RxReachability_Example-checkManifestLockResult.txt", 197 | ); 198 | runOnlyForDeploymentPostprocessing = 0; 199 | shellPath = /bin/sh; 200 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 201 | showEnvVarsInLog = 0; 202 | }; 203 | /* End PBXShellScriptBuildPhase section */ 204 | 205 | /* Begin PBXSourcesBuildPhase section */ 206 | 0CC2E74224914D3200430B43 /* Sources */ = { 207 | isa = PBXSourcesBuildPhase; 208 | buildActionMask = 2147483647; 209 | files = ( 210 | 0CC2E74E24914D3200430B43 /* ViewController.swift in Sources */, 211 | 0CC2E74A24914D3200430B43 /* AppDelegate.swift in Sources */, 212 | ); 213 | runOnlyForDeploymentPostprocessing = 0; 214 | }; 215 | /* End PBXSourcesBuildPhase section */ 216 | 217 | /* Begin PBXVariantGroup section */ 218 | 0CC2E74F24914D3200430B43 /* Main.storyboard */ = { 219 | isa = PBXVariantGroup; 220 | children = ( 221 | 0CC2E75024914D3200430B43 /* Base */, 222 | ); 223 | name = Main.storyboard; 224 | sourceTree = ""; 225 | }; 226 | 0CC2E75424914D3300430B43 /* LaunchScreen.storyboard */ = { 227 | isa = PBXVariantGroup; 228 | children = ( 229 | 0CC2E75524914D3300430B43 /* Base */, 230 | ); 231 | name = LaunchScreen.storyboard; 232 | sourceTree = ""; 233 | }; 234 | /* End PBXVariantGroup section */ 235 | 236 | /* Begin XCBuildConfiguration section */ 237 | 0CC2E75824914D3300430B43 /* Debug */ = { 238 | isa = XCBuildConfiguration; 239 | buildSettings = { 240 | ALWAYS_SEARCH_USER_PATHS = NO; 241 | CLANG_ANALYZER_NONNULL = YES; 242 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 243 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 244 | CLANG_CXX_LIBRARY = "libc++"; 245 | CLANG_ENABLE_MODULES = YES; 246 | CLANG_ENABLE_OBJC_ARC = YES; 247 | CLANG_ENABLE_OBJC_WEAK = YES; 248 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 249 | CLANG_WARN_BOOL_CONVERSION = YES; 250 | CLANG_WARN_COMMA = YES; 251 | CLANG_WARN_CONSTANT_CONVERSION = YES; 252 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 253 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 254 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 255 | CLANG_WARN_EMPTY_BODY = YES; 256 | CLANG_WARN_ENUM_CONVERSION = YES; 257 | CLANG_WARN_INFINITE_RECURSION = YES; 258 | CLANG_WARN_INT_CONVERSION = YES; 259 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 260 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 261 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 262 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 263 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 264 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 265 | CLANG_WARN_STRICT_PROTOTYPES = YES; 266 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 267 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 268 | CLANG_WARN_UNREACHABLE_CODE = YES; 269 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 270 | COPY_PHASE_STRIP = NO; 271 | DEBUG_INFORMATION_FORMAT = dwarf; 272 | ENABLE_STRICT_OBJC_MSGSEND = YES; 273 | ENABLE_TESTABILITY = YES; 274 | GCC_C_LANGUAGE_STANDARD = gnu11; 275 | GCC_DYNAMIC_NO_PIC = NO; 276 | GCC_NO_COMMON_BLOCKS = YES; 277 | GCC_OPTIMIZATION_LEVEL = 0; 278 | GCC_PREPROCESSOR_DEFINITIONS = ( 279 | "DEBUG=1", 280 | "$(inherited)", 281 | ); 282 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 283 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 284 | GCC_WARN_UNDECLARED_SELECTOR = YES; 285 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 286 | GCC_WARN_UNUSED_FUNCTION = YES; 287 | GCC_WARN_UNUSED_VARIABLE = YES; 288 | IPHONEOS_DEPLOYMENT_TARGET = 13.5; 289 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 290 | MTL_FAST_MATH = YES; 291 | ONLY_ACTIVE_ARCH = YES; 292 | SDKROOT = iphoneos; 293 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 294 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 295 | }; 296 | name = Debug; 297 | }; 298 | 0CC2E75924914D3300430B43 /* Release */ = { 299 | isa = XCBuildConfiguration; 300 | buildSettings = { 301 | ALWAYS_SEARCH_USER_PATHS = NO; 302 | CLANG_ANALYZER_NONNULL = YES; 303 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 304 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 305 | CLANG_CXX_LIBRARY = "libc++"; 306 | CLANG_ENABLE_MODULES = YES; 307 | CLANG_ENABLE_OBJC_ARC = YES; 308 | CLANG_ENABLE_OBJC_WEAK = YES; 309 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 310 | CLANG_WARN_BOOL_CONVERSION = YES; 311 | CLANG_WARN_COMMA = YES; 312 | CLANG_WARN_CONSTANT_CONVERSION = YES; 313 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 314 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 315 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 316 | CLANG_WARN_EMPTY_BODY = YES; 317 | CLANG_WARN_ENUM_CONVERSION = YES; 318 | CLANG_WARN_INFINITE_RECURSION = YES; 319 | CLANG_WARN_INT_CONVERSION = YES; 320 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 321 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 322 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 323 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 324 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 325 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 326 | CLANG_WARN_STRICT_PROTOTYPES = YES; 327 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 328 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 329 | CLANG_WARN_UNREACHABLE_CODE = YES; 330 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 331 | COPY_PHASE_STRIP = NO; 332 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 333 | ENABLE_NS_ASSERTIONS = NO; 334 | ENABLE_STRICT_OBJC_MSGSEND = YES; 335 | GCC_C_LANGUAGE_STANDARD = gnu11; 336 | GCC_NO_COMMON_BLOCKS = YES; 337 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 338 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 339 | GCC_WARN_UNDECLARED_SELECTOR = YES; 340 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 341 | GCC_WARN_UNUSED_FUNCTION = YES; 342 | GCC_WARN_UNUSED_VARIABLE = YES; 343 | IPHONEOS_DEPLOYMENT_TARGET = 13.5; 344 | MTL_ENABLE_DEBUG_INFO = NO; 345 | MTL_FAST_MATH = YES; 346 | SDKROOT = iphoneos; 347 | SWIFT_COMPILATION_MODE = wholemodule; 348 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 349 | VALIDATE_PRODUCT = YES; 350 | }; 351 | name = Release; 352 | }; 353 | 0CC2E75B24914D3300430B43 /* Debug */ = { 354 | isa = XCBuildConfiguration; 355 | baseConfigurationReference = 968ADC5647A82A17737C9C15 /* Pods-RxReachability_Example.debug.xcconfig */; 356 | buildSettings = { 357 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 358 | CODE_SIGN_STYLE = Automatic; 359 | INFOPLIST_FILE = RxReachability/Info.plist; 360 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 361 | LD_RUNPATH_SEARCH_PATHS = ( 362 | "$(inherited)", 363 | "@executable_path/Frameworks", 364 | ); 365 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.demo.RxReachability; 366 | PRODUCT_NAME = RxReachability_Example; 367 | SWIFT_VERSION = 5.0; 368 | TARGETED_DEVICE_FAMILY = 1; 369 | }; 370 | name = Debug; 371 | }; 372 | 0CC2E75C24914D3300430B43 /* Release */ = { 373 | isa = XCBuildConfiguration; 374 | baseConfigurationReference = 56A76D436C25C1A013CB9DE1 /* Pods-RxReachability_Example.release.xcconfig */; 375 | buildSettings = { 376 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 377 | CODE_SIGN_STYLE = Automatic; 378 | INFOPLIST_FILE = RxReachability/Info.plist; 379 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 380 | LD_RUNPATH_SEARCH_PATHS = ( 381 | "$(inherited)", 382 | "@executable_path/Frameworks", 383 | ); 384 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.demo.RxReachability; 385 | PRODUCT_NAME = RxReachability_Example; 386 | SWIFT_VERSION = 5.0; 387 | TARGETED_DEVICE_FAMILY = 1; 388 | }; 389 | name = Release; 390 | }; 391 | /* End XCBuildConfiguration section */ 392 | 393 | /* Begin XCConfigurationList section */ 394 | 0CC2E74124914D3200430B43 /* Build configuration list for PBXProject "RxReachability_Example" */ = { 395 | isa = XCConfigurationList; 396 | buildConfigurations = ( 397 | 0CC2E75824914D3300430B43 /* Debug */, 398 | 0CC2E75924914D3300430B43 /* Release */, 399 | ); 400 | defaultConfigurationIsVisible = 0; 401 | defaultConfigurationName = Release; 402 | }; 403 | 0CC2E75A24914D3300430B43 /* Build configuration list for PBXNativeTarget "RxReachability_Example" */ = { 404 | isa = XCConfigurationList; 405 | buildConfigurations = ( 406 | 0CC2E75B24914D3300430B43 /* Debug */, 407 | 0CC2E75C24914D3300430B43 /* Release */, 408 | ); 409 | defaultConfigurationIsVisible = 0; 410 | defaultConfigurationName = Release; 411 | }; 412 | /* End XCConfigurationList section */ 413 | }; 414 | rootObject = 0CC2E73E24914D3200430B43 /* Project object */; 415 | } 416 | -------------------------------------------------------------------------------- /RxReachability-Example/RxReachability_Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RxReachability-Example/RxReachability_Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /RxReachability-Example/RxReachability_Example.xcodeproj/xcshareddata/xcschemes/RxReachability.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 60 | 62 | 68 | 69 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /RxReachability-Example/RxReachability_Example.xcodeproj/xcshareddata/xcschemes/RxReachability_Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 60 | 62 | 68 | 69 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /RxReachability-Example/RxReachability_Example.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /RxReachability-Example/RxReachability_Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /RxReachability.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint RxReachability.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | # 5 | # Any lines starting with a # are optional, but their use is encouraged 6 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = 'RxReachability' 11 | s.version = '1.2.1' 12 | s.summary = 'RxSwift bindings for Reachability' 13 | 14 | s.description = <<-DESC 15 | RxReachability adds easy to use RxSwift bindings for [ReachabilitySwift](https://github.com/ashleymills/Reachability.swift). 16 | You can react to network reachability changes and even retry observables when network comes back up. 17 | DESC 18 | 19 | s.homepage = 'https://github.com/RxSwiftCommunity/RxReachability' 20 | s.documentation_url = 'https://community.rxswift.org/RxReachability/' 21 | s.license = { :type => 'MIT', :file => 'LICENSE' } 22 | s.authors = { 23 | 'Joseph Mattiello' => 'git@joemattiello.com', 24 | 'Ivan Bruel' => 'ivan.bruel@gmail.com', 25 | 'Bruno Oliveira' => 'bm.oliveira.dev@gmail.com', 26 | 'RxSwiftCommunity' => 'https://github.com/RxSwiftCommunity' 27 | } 28 | s.source = { :git => 'https://github.com/RxSwiftCommunity/RxReachability.git', :tag => s.version.to_s } 29 | s.social_media_url = 'https://rxswift.slack.com' 30 | s.source_files = 'Sources/RxReachability/**/*' 31 | 32 | s.ios.deployment_target = '11.0' 33 | s.osx.deployment_target = '10.10' 34 | s.tvos.deployment_target = '11.0' 35 | 36 | s.swift_version = '5.2' 37 | 38 | s.dependency 'ReachabilitySwift', '>= 5.0', '< 6.0' 39 | s.dependency 'RxSwift', '~> 6' 40 | s.dependency 'RxCocoa', '~> 6' 41 | 42 | s.test_spec do |test_spec| 43 | test_spec.test_type = :unit 44 | test_spec.requires_app_host = false 45 | 46 | # test_spec.app_host_name = 'RxReachability/RxReachability-Example' 47 | # test_spec.dependency 'RxReachability/RxReachability-Example' 48 | 49 | test_spec.source_files = 'Tests/RxReachabilityTests/**/*.swift' 50 | test_spec.dependency 'RxBlocking', '~> 6' 51 | end 52 | 53 | s.app_spec 'RxReachability-Example' do |app_spec| 54 | app_spec.source_files = 'RxReachabilityTests-Example/RxReachabilityTests/**/*.swift' 55 | app_spec.ios.deployment_target = '11.0' 56 | app_spec.osx.deployment_target = '10.10' 57 | app_spec.tvos.deployment_target = '11.0' 58 | 59 | app_spec.info_plist = { 60 | 'CFBundleIdentifier' => 'org.cocoapods.demo.RxReachability', 61 | 'UISupportedInterfaceOrientations' => [ 62 | 'UIInterfaceOrientationPortrait', 63 | ], 64 | 'UILaunchStoryboardName' => 'LaunchScreen', 65 | 'UIMainStoryboardFile' => 'Main', 66 | } 67 | end 68 | end 69 | -------------------------------------------------------------------------------- /Sources/RxReachability/ObservableType+Reachability.swift: -------------------------------------------------------------------------------- 1 | // 2 | // The MIT License (MIT) 3 | // 4 | // Copyright (c) 2015 RxSwift Community 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | 25 | import Foundation 26 | import Reachability 27 | import RxCocoa 28 | import RxSwift 29 | 30 | public extension ObservableType { 31 | 32 | /// An oberverable to execute retry and execute code on reconnect after a timeout `timeout` 33 | /// - Parameter timeout: Seconds for timeout 34 | /// - Returns: An observable sequence with a RxError.timeout in case of a timeout. 35 | func retryOnConnect(timeout: DispatchTimeInterval) -> Observable { 36 | return retry { _ in 37 | return Reachability.rx.isConnected 38 | .timeout(timeout, scheduler: MainScheduler.asyncInstance) 39 | } 40 | } 41 | 42 | /// An filtered oberverable to execute retry and execute code on reconnect after a timeout `timeout` 43 | /// - Parameters: 44 | /// - timeout: Seconds for timeout 45 | /// - predicate: A function to test each source element for a condition. 46 | /// - Returns: An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete. 47 | func retryOnConnect( 48 | timeout: DispatchTimeInterval, 49 | predicate: @escaping (Swift.Error) -> Bool 50 | ) -> Observable { 51 | return retry { 52 | return $0 53 | .filter(predicate) 54 | .flatMap { _ in 55 | Reachability 56 | .rx 57 | .isConnected 58 | .timeout( 59 | timeout, 60 | scheduler: MainScheduler.asyncInstance 61 | ) 62 | } 63 | } 64 | } 65 | 66 | /// An filtered oberverable to execute retry and execute code on reconnect after a timeout `timeout` 67 | /// - Parameters: 68 | /// - timeout: Seconds for timeout 69 | /// - predicate: A function to test each source element for a condition. 70 | /// - Returns: An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences and that at any point in time produces the elements of the most recent inner observable sequence that has been received. 71 | func retryLatestOnConnect( 72 | timeout: DispatchTimeInterval, 73 | predicate: @escaping (Swift.Error) -> Bool 74 | ) -> Observable { 75 | return retry { 76 | return $0 77 | .filter(predicate) 78 | .flatMapLatest { _ in 79 | Reachability 80 | .rx 81 | .isConnected 82 | .timeout( 83 | timeout, 84 | scheduler: MainScheduler.asyncInstance 85 | ) 86 | } 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /Sources/RxReachability/Reachability+Rx.swift: -------------------------------------------------------------------------------- 1 | // 2 | // The MIT License (MIT) 3 | // 4 | // Copyright (c) 2015 RxSwift Community 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | 25 | import Foundation 26 | import Reachability 27 | import RxCocoa 28 | import RxSwift 29 | 30 | extension Reachability: ReactiveCompatible { } 31 | 32 | public extension Reactive where Base: Reachability { 33 | 34 | /// Global to observe when `Reachability` status changes. 35 | static var reachabilityChanged: Observable { 36 | return NotificationCenter.default.rx.notification(Notification.Name.reachabilityChanged) 37 | .flatMap { notification -> Observable in 38 | guard let reachability = notification.object as? Reachability else { 39 | return .empty() 40 | } 41 | return .just(reachability) 42 | } 43 | } 44 | 45 | /// Global to observe when `Reachability.Connection` status changes. 46 | static var status: Observable { 47 | return reachabilityChanged 48 | .map { $0.connection } 49 | } 50 | 51 | /// Global to observe a `Bool` when `Reachability.Connection != .unavailable` . 52 | static var isReachable: Observable { 53 | return reachabilityChanged 54 | .map { $0.connection != .unavailable } 55 | } 56 | 57 | /// Global to observe a `Void` when `Reachability.Connection != .unavailable` . 58 | static var isConnected: Observable { 59 | return isReachable 60 | .filter { $0 } 61 | .map { _ in Void() } 62 | } 63 | 64 | /// Global to observe a `Void` when `Reachability.Connection == .unavailable` . 65 | static var isDisconnected: Observable { 66 | return isReachable 67 | .filter { !$0 } 68 | .map { _ in Void() } 69 | } 70 | } 71 | 72 | public extension Reactive where Base: Reachability { 73 | 74 | /// Rx `Observable` to observe when `Reachability` status changes. 75 | var reachabilityChanged: Observable { 76 | return NotificationCenter.default.rx.notification(Notification.Name.reachabilityChanged, object: base) 77 | .flatMap { notification -> Observable in 78 | guard let reachability = notification.object as? Reachability else { 79 | return .empty() 80 | } 81 | return .just(reachability) 82 | } 83 | } 84 | 85 | /// Rx `Observable` to observe when `Reachability.Connection` value changes. 86 | var status: Observable { 87 | return reachabilityChanged 88 | .map { $0.connection } 89 | } 90 | 91 | /// Instance variable to observe a `Bool` when `Reachability.Connection != .unavailable` . 92 | var isReachable: Observable { 93 | return reachabilityChanged 94 | .map { $0.connection != .unavailable } 95 | } 96 | 97 | /// Instance variable to observe a `Void` when `Reachability.Connection != .unavailable` . 98 | var isConnected: Observable { 99 | return isReachable 100 | .filter { $0 } 101 | .map { _ in Void() } 102 | } 103 | 104 | /// Instance variable to observe a `Void` when `Reachability.Connection == .unavailable` . 105 | var isDisconnected: Observable { 106 | return isReachable 107 | .filter { !$0 } 108 | .map { _ in Void() } 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /Tests/LinuxMain.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | import RxReachabilityTests 4 | 5 | var tests = [XCTestCaseEntry]() 6 | tests += RxReachabilityTests.allTests() 7 | XCTMain(tests) 8 | -------------------------------------------------------------------------------- /Tests/RxReachabilityTests/RxReachabilityTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import Reachability 3 | import RxBlocking 4 | import RxSwift 5 | @testable import RxReachability 6 | 7 | final class RxReachabilityTests: XCTestCase { 8 | 9 | let reachability: Reachability! = try? Reachability() 10 | let disposeBag = DisposeBag() 11 | 12 | override func setUp() { 13 | XCTAssertNoThrow(try reachability.startNotifier()) 14 | } 15 | 16 | override func tearDown() { 17 | reachability.stopNotifier() 18 | } 19 | 20 | func test_reachabilityChanged() throws { 21 | _ = XCTAssertNoThrow(try reachability.rx.reachabilityChanged.toBlocking(timeout: 1).first()) 22 | } 23 | 24 | func test_isReachable() throws { 25 | let isReachable = try reachability.rx.isReachable.toBlocking(timeout: 1).first() 26 | XCTAssertNotNil(isReachable) 27 | XCTAssertTrue(isReachable!) 28 | } 29 | 30 | func test_status() throws { 31 | let status = try reachability.rx.status.toBlocking(timeout: 1).first() 32 | XCTAssertNotNil(status) 33 | XCTAssertNotEqual(status!, .unavailable) 34 | } 35 | 36 | func test_isConnected() throws { 37 | XCTAssertNoThrow(try reachability.rx.isConnected.toBlocking(timeout: 1).first()) 38 | } 39 | 40 | func test_isDisconnected() throws { 41 | _ = reachability.rx.isDisconnected.single() 42 | } 43 | 44 | static var allTests = [ 45 | ("test_reachabilityChanged", test_reachabilityChanged), 46 | ("test_isReachable", test_isReachable), 47 | ("test_status", test_status), 48 | ("test_isConnected", test_isConnected), 49 | ("test_isDisconnected", test_isDisconnected) 50 | ] 51 | } 52 | -------------------------------------------------------------------------------- /Tests/RxReachabilityTests/XCTestManifests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | #if !canImport(ObjectiveC) 4 | public func allTests() -> [XCTestCaseEntry] { 5 | return [ 6 | testCase(RxReachabilityTests.allTests) 7 | ] 8 | } 9 | #endif 10 | -------------------------------------------------------------------------------- /docs/Extensions/ObservableType.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ObservableType Extension Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 |

RxReachability 1.2.1 Docs (100% documented)

21 |

View on GitHub

22 |

Install in Dash

23 |

24 |

25 | 26 |
27 |

28 |
29 |
30 |
31 | 36 |
37 |
38 | 61 |
62 |
63 |
64 |

ObservableType

65 |
66 |
67 | 68 |
public extension ObservableType
69 | 70 |
71 |
72 | 73 |
74 |
75 |
76 |
    77 |
  • 78 |
    79 | 80 | 81 | 82 | retryOnConnect(timeout:) 83 | 84 |
    85 |
    86 |
    87 |
    88 |
    89 |
    90 |

    An oberverable to execute retry and execute code on reconnect after a timeout timeout

    91 | 92 |
    93 |
    94 |

    Declaration

    95 |
    96 |

    Swift

    97 |
    func retryOnConnect(timeout: DispatchTimeInterval) -> Observable<Element>
    98 | 99 |
    100 |
    101 |
    102 |

    Parameters

    103 | 104 | 105 | 106 | 111 | 116 | 117 | 118 |
    107 | 108 | timeout 109 | 110 | 112 |
    113 |

    Seconds for timeout

    114 |
    115 |
    119 |
    120 |
    121 |

    Return Value

    122 |

    An observable sequence with a RxError.timeout in case of a timeout.

    123 |
    124 |
    125 | Show on GitHub 126 |
    127 |
    128 |
    129 |
  • 130 |
  • 131 |
    132 | 133 | 134 | 135 | retryOnConnect(timeout:predicate:) 136 | 137 |
    138 |
    139 |
    140 |
    141 |
    142 |
    143 |

    An filtered oberverable to execute retry and execute code on reconnect after a timeout timeout

    144 | 145 |
    146 |
    147 |

    Declaration

    148 |
    149 |

    Swift

    150 |
    func retryOnConnect(
    151 |   timeout: DispatchTimeInterval,
    152 |   predicate: @escaping (Swift.Error) -> Bool
    153 | ) -> Observable<Element>
    154 | 155 |
    156 |
    157 |
    158 |

    Parameters

    159 | 160 | 161 | 162 | 167 | 172 | 173 | 174 | 179 | 184 | 185 | 186 |
    163 | 164 | timeout 165 | 166 | 168 |
    169 |

    Seconds for timeout

    170 |
    171 |
    175 | 176 | predicate 177 | 178 | 180 |
    181 |

    A function to test each source element for a condition.

    182 |
    183 |
    187 |
    188 |
    189 |

    Return Value

    190 |

    An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete.

    191 |
    192 |
    193 | Show on GitHub 194 |
    195 |
    196 |
    197 |
  • 198 |
  • 199 |
    200 | 201 | 202 | 203 | retryLatestOnConnect(timeout:predicate:) 204 | 205 |
    206 |
    207 |
    208 |
    209 |
    210 |
    211 |

    An filtered oberverable to execute retry and execute code on reconnect after a timeout timeout

    212 | 213 |
    214 |
    215 |

    Declaration

    216 |
    217 |

    Swift

    218 |
    func retryLatestOnConnect(
    219 |   timeout: DispatchTimeInterval,
    220 |   predicate: @escaping (Swift.Error) -> Bool
    221 | ) -> Observable<Element>
    222 | 223 |
    224 |
    225 |
    226 |

    Parameters

    227 | 228 | 229 | 230 | 235 | 240 | 241 | 242 | 247 | 252 | 253 | 254 |
    231 | 232 | timeout 233 | 234 | 236 |
    237 |

    Seconds for timeout

    238 |
    239 |
    243 | 244 | predicate 245 | 246 | 248 |
    249 |

    A function to test each source element for a condition.

    250 |
    251 |
    255 |
    256 |
    257 |

    Return Value

    258 |

    An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences and that at any point in time produces the elements of the most recent inner observable sequence that has been received.

    259 |
    260 |
    261 | Show on GitHub 262 |
    263 |
    264 |
    265 |
  • 266 |
267 |
268 |
269 |
270 | 274 |
275 |
276 | 277 | 278 | 279 | -------------------------------------------------------------------------------- /docs/Observable Factories.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Observable Factories Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 |

RxReachability 1.2.1 Docs (100% documented)

21 |

View on GitHub

22 |

Install in Dash

23 |

24 |

25 | 26 |
27 |

28 |
29 |
30 |
31 | 36 |
37 |
38 | 61 |
62 |
63 |
64 |

Observable Factories

65 | 66 |
67 |
68 |
69 |
    70 |
  • 71 |
    72 | 73 | 74 | 75 | Reachability 76 | 77 |
    78 |
    79 |
    80 |
    81 |
    82 |
    83 | 84 |
    85 |
    86 |

    Declaration

    87 |
    88 |

    Swift

    89 |
    extension Reachability: ReactiveCompatible
    90 | 91 |
    92 |
    93 |
    94 |
    95 |
  • 96 |
  • 97 |
    98 | 99 | 100 | 101 | ObservableType 102 | 103 |
    104 |
    105 |
    106 |
    107 |
    108 |
    109 | 110 | See more 111 |
    112 |
    113 |

    Declaration

    114 |
    115 |

    Swift

    116 |
    public extension ObservableType
    117 | 118 |
    119 |
    120 |
    121 |
    122 |
  • 123 |
124 |
125 |
126 |
127 | 131 |
132 |
133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /docs/Observables.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Observables Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 |

RxReachability 1.2.1 Docs (100% documented)

21 |

View on GitHub

22 |

Install in Dash

23 |

24 |

25 | 26 |
27 |

28 |
29 |
30 |
31 | 36 |
37 |
38 | 61 |
62 |
63 |
64 |

Observables

65 | 66 |
67 |
68 |
69 |
    70 |
  • 71 |
    72 | 73 | 74 | 75 | Reactive 76 | 77 |
    78 |
    79 |
    80 |
    81 |
    82 |
    83 | 84 | See more 85 |
    86 |
    87 |

    Declaration

    88 |
    89 |

    Swift

    90 |
    public extension Reactive where Base: Reachability
    91 | 92 |
    93 |
    94 |
    95 |
    96 |
  • 97 |
98 |
99 |
100 |
101 | 105 |
106 |
107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /docs/badge.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | documentation 17 | 18 | 19 | documentation 20 | 21 | 22 | 100% 23 | 24 | 25 | 100% 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /docs/css/highlight.css: -------------------------------------------------------------------------------- 1 | /* Credit to https://gist.github.com/wataru420/2048287 */ 2 | .highlight { 3 | /* Comment */ 4 | /* Error */ 5 | /* Keyword */ 6 | /* Operator */ 7 | /* Comment.Multiline */ 8 | /* Comment.Preproc */ 9 | /* Comment.Single */ 10 | /* Comment.Special */ 11 | /* Generic.Deleted */ 12 | /* Generic.Deleted.Specific */ 13 | /* Generic.Emph */ 14 | /* Generic.Error */ 15 | /* Generic.Heading */ 16 | /* Generic.Inserted */ 17 | /* Generic.Inserted.Specific */ 18 | /* Generic.Output */ 19 | /* Generic.Prompt */ 20 | /* Generic.Strong */ 21 | /* Generic.Subheading */ 22 | /* Generic.Traceback */ 23 | /* Keyword.Constant */ 24 | /* Keyword.Declaration */ 25 | /* Keyword.Pseudo */ 26 | /* Keyword.Reserved */ 27 | /* Keyword.Type */ 28 | /* Literal.Number */ 29 | /* Literal.String */ 30 | /* Name.Attribute */ 31 | /* Name.Builtin */ 32 | /* Name.Class */ 33 | /* Name.Constant */ 34 | /* Name.Entity */ 35 | /* Name.Exception */ 36 | /* Name.Function */ 37 | /* Name.Namespace */ 38 | /* Name.Tag */ 39 | /* Name.Variable */ 40 | /* Operator.Word */ 41 | /* Text.Whitespace */ 42 | /* Literal.Number.Float */ 43 | /* Literal.Number.Hex */ 44 | /* Literal.Number.Integer */ 45 | /* Literal.Number.Oct */ 46 | /* Literal.String.Backtick */ 47 | /* Literal.String.Char */ 48 | /* Literal.String.Doc */ 49 | /* Literal.String.Double */ 50 | /* Literal.String.Escape */ 51 | /* Literal.String.Heredoc */ 52 | /* Literal.String.Interpol */ 53 | /* Literal.String.Other */ 54 | /* Literal.String.Regex */ 55 | /* Literal.String.Single */ 56 | /* Literal.String.Symbol */ 57 | /* Name.Builtin.Pseudo */ 58 | /* Name.Variable.Class */ 59 | /* Name.Variable.Global */ 60 | /* Name.Variable.Instance */ 61 | /* Literal.Number.Integer.Long */ } 62 | .highlight .c { 63 | color: #999988; 64 | font-style: italic; } 65 | .highlight .err { 66 | color: #a61717; 67 | background-color: #e3d2d2; } 68 | .highlight .k { 69 | color: #000000; 70 | font-weight: bold; } 71 | .highlight .o { 72 | color: #000000; 73 | font-weight: bold; } 74 | .highlight .cm { 75 | color: #999988; 76 | font-style: italic; } 77 | .highlight .cp { 78 | color: #999999; 79 | font-weight: bold; } 80 | .highlight .c1 { 81 | color: #999988; 82 | font-style: italic; } 83 | .highlight .cs { 84 | color: #999999; 85 | font-weight: bold; 86 | font-style: italic; } 87 | .highlight .gd { 88 | color: #000000; 89 | background-color: #ffdddd; } 90 | .highlight .gd .x { 91 | color: #000000; 92 | background-color: #ffaaaa; } 93 | .highlight .ge { 94 | color: #000000; 95 | font-style: italic; } 96 | .highlight .gr { 97 | color: #aa0000; } 98 | .highlight .gh { 99 | color: #999999; } 100 | .highlight .gi { 101 | color: #000000; 102 | background-color: #ddffdd; } 103 | .highlight .gi .x { 104 | color: #000000; 105 | background-color: #aaffaa; } 106 | .highlight .go { 107 | color: #888888; } 108 | .highlight .gp { 109 | color: #555555; } 110 | .highlight .gs { 111 | font-weight: bold; } 112 | .highlight .gu { 113 | color: #aaaaaa; } 114 | .highlight .gt { 115 | color: #aa0000; } 116 | .highlight .kc { 117 | color: #000000; 118 | font-weight: bold; } 119 | .highlight .kd { 120 | color: #000000; 121 | font-weight: bold; } 122 | .highlight .kp { 123 | color: #000000; 124 | font-weight: bold; } 125 | .highlight .kr { 126 | color: #000000; 127 | font-weight: bold; } 128 | .highlight .kt { 129 | color: #445588; } 130 | .highlight .m { 131 | color: #009999; } 132 | .highlight .s { 133 | color: #d14; } 134 | .highlight .na { 135 | color: #008080; } 136 | .highlight .nb { 137 | color: #0086B3; } 138 | .highlight .nc { 139 | color: #445588; 140 | font-weight: bold; } 141 | .highlight .no { 142 | color: #008080; } 143 | .highlight .ni { 144 | color: #800080; } 145 | .highlight .ne { 146 | color: #990000; 147 | font-weight: bold; } 148 | .highlight .nf { 149 | color: #990000; } 150 | .highlight .nn { 151 | color: #555555; } 152 | .highlight .nt { 153 | color: #000080; } 154 | .highlight .nv { 155 | color: #008080; } 156 | .highlight .ow { 157 | color: #000000; 158 | font-weight: bold; } 159 | .highlight .w { 160 | color: #bbbbbb; } 161 | .highlight .mf { 162 | color: #009999; } 163 | .highlight .mh { 164 | color: #009999; } 165 | .highlight .mi { 166 | color: #009999; } 167 | .highlight .mo { 168 | color: #009999; } 169 | .highlight .sb { 170 | color: #d14; } 171 | .highlight .sc { 172 | color: #d14; } 173 | .highlight .sd { 174 | color: #d14; } 175 | .highlight .s2 { 176 | color: #d14; } 177 | .highlight .se { 178 | color: #d14; } 179 | .highlight .sh { 180 | color: #d14; } 181 | .highlight .si { 182 | color: #d14; } 183 | .highlight .sx { 184 | color: #d14; } 185 | .highlight .sr { 186 | color: #009926; } 187 | .highlight .s1 { 188 | color: #d14; } 189 | .highlight .ss { 190 | color: #990073; } 191 | .highlight .bp { 192 | color: #999999; } 193 | .highlight .vc { 194 | color: #008080; } 195 | .highlight .vg { 196 | color: #008080; } 197 | .highlight .vi { 198 | color: #008080; } 199 | .highlight .il { 200 | color: #009999; } 201 | -------------------------------------------------------------------------------- /docs/css/jazzy.css: -------------------------------------------------------------------------------- 1 | html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td { 2 | background: transparent; 3 | border: 0; 4 | margin: 0; 5 | outline: 0; 6 | padding: 0; 7 | vertical-align: baseline; } 8 | 9 | body { 10 | background-color: #f2f2f2; 11 | font-family: Helvetica, freesans, Arial, sans-serif; 12 | font-size: 14px; 13 | -webkit-font-smoothing: subpixel-antialiased; 14 | word-wrap: break-word; } 15 | 16 | h1, h2, h3 { 17 | margin-top: 0.8em; 18 | margin-bottom: 0.3em; 19 | font-weight: 100; 20 | color: black; } 21 | 22 | h1 { 23 | font-size: 2.5em; } 24 | 25 | h2 { 26 | font-size: 2em; 27 | border-bottom: 1px solid #e2e2e2; } 28 | 29 | h4 { 30 | font-size: 13px; 31 | line-height: 1.5; 32 | margin-top: 21px; } 33 | 34 | h5 { 35 | font-size: 1.1em; } 36 | 37 | h6 { 38 | font-size: 1.1em; 39 | color: #777; } 40 | 41 | .section-name { 42 | color: gray; 43 | display: block; 44 | font-family: Helvetica; 45 | font-size: 22px; 46 | font-weight: 100; 47 | margin-bottom: 15px; } 48 | 49 | pre, code { 50 | font: 0.95em Menlo, monospace; 51 | color: #777; 52 | word-wrap: normal; } 53 | 54 | p code, li code { 55 | background-color: #eee; 56 | padding: 2px 4px; 57 | border-radius: 4px; } 58 | 59 | pre > code { 60 | padding: 0; } 61 | 62 | a { 63 | color: #0088cc; 64 | text-decoration: none; } 65 | a code { 66 | color: inherit; } 67 | 68 | ul { 69 | padding-left: 15px; } 70 | 71 | li { 72 | line-height: 1.8em; } 73 | 74 | img { 75 | max-width: 100%; } 76 | 77 | blockquote { 78 | margin-left: 0; 79 | padding: 0 10px; 80 | border-left: 4px solid #ccc; } 81 | 82 | .content-wrapper { 83 | margin: 0 auto; 84 | width: 980px; } 85 | 86 | header { 87 | font-size: 0.85em; 88 | line-height: 32px; 89 | background-color: #414141; 90 | position: fixed; 91 | width: 100%; 92 | z-index: 3; } 93 | header img { 94 | padding-right: 6px; 95 | vertical-align: -4px; 96 | height: 16px; } 97 | header a { 98 | color: #fff; } 99 | header p { 100 | float: left; 101 | color: #999; } 102 | header .header-right { 103 | float: right; 104 | margin-left: 16px; } 105 | 106 | #breadcrumbs { 107 | background-color: #f2f2f2; 108 | height: 21px; 109 | padding-top: 17px; 110 | position: fixed; 111 | width: 100%; 112 | z-index: 2; 113 | margin-top: 32px; } 114 | #breadcrumbs #carat { 115 | height: 10px; 116 | margin: 0 5px; } 117 | 118 | .sidebar { 119 | background-color: #f9f9f9; 120 | border: 1px solid #e2e2e2; 121 | overflow-y: auto; 122 | overflow-x: hidden; 123 | position: fixed; 124 | top: 70px; 125 | bottom: 0; 126 | width: 230px; 127 | word-wrap: normal; } 128 | 129 | .nav-groups { 130 | list-style-type: none; 131 | background: #fff; 132 | padding-left: 0; } 133 | 134 | .nav-group-name { 135 | border-bottom: 1px solid #e2e2e2; 136 | font-size: 1.1em; 137 | font-weight: 100; 138 | padding: 15px 0 15px 20px; } 139 | .nav-group-name > a { 140 | color: #333; } 141 | 142 | .nav-group-tasks { 143 | margin-top: 5px; } 144 | 145 | .nav-group-task { 146 | font-size: 0.9em; 147 | list-style-type: none; 148 | white-space: nowrap; } 149 | .nav-group-task a { 150 | color: #888; } 151 | 152 | .main-content { 153 | background-color: #fff; 154 | border: 1px solid #e2e2e2; 155 | margin-left: 246px; 156 | position: absolute; 157 | overflow: hidden; 158 | padding-bottom: 20px; 159 | top: 70px; 160 | width: 734px; } 161 | .main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote { 162 | margin-bottom: 1em; } 163 | .main-content p { 164 | line-height: 1.8em; } 165 | .main-content section .section:first-child { 166 | margin-top: 0; 167 | padding-top: 0; } 168 | .main-content section .task-group-section .task-group:first-of-type { 169 | padding-top: 10px; } 170 | .main-content section .task-group-section .task-group:first-of-type .section-name { 171 | padding-top: 15px; } 172 | .main-content section .heading:before { 173 | content: ""; 174 | display: block; 175 | padding-top: 70px; 176 | margin: -70px 0 0; } 177 | .main-content .section-name p { 178 | margin-bottom: inherit; 179 | line-height: inherit; } 180 | .main-content .section-name code { 181 | background-color: inherit; 182 | padding: inherit; 183 | color: inherit; } 184 | 185 | .section { 186 | padding: 0 25px; } 187 | 188 | .highlight { 189 | background-color: #eee; 190 | padding: 10px 12px; 191 | border: 1px solid #e2e2e2; 192 | border-radius: 4px; 193 | overflow-x: auto; } 194 | 195 | .declaration .highlight { 196 | overflow-x: initial; 197 | padding: 0 40px 40px 0; 198 | margin-bottom: -25px; 199 | background-color: transparent; 200 | border: none; } 201 | 202 | .section-name { 203 | margin: 0; 204 | margin-left: 18px; } 205 | 206 | .task-group-section { 207 | margin-top: 10px; 208 | padding-left: 6px; 209 | border-top: 1px solid #e2e2e2; } 210 | 211 | .task-group { 212 | padding-top: 0px; } 213 | 214 | .task-name-container a[name]:before { 215 | content: ""; 216 | display: block; 217 | padding-top: 70px; 218 | margin: -70px 0 0; } 219 | 220 | .section-name-container { 221 | position: relative; 222 | display: inline-block; } 223 | .section-name-container .section-name-link { 224 | position: absolute; 225 | top: 0; 226 | left: 0; 227 | bottom: 0; 228 | right: 0; 229 | margin-bottom: 0; } 230 | .section-name-container .section-name { 231 | position: relative; 232 | pointer-events: none; 233 | z-index: 1; } 234 | .section-name-container .section-name a { 235 | pointer-events: auto; } 236 | 237 | .item { 238 | padding-top: 8px; 239 | width: 100%; 240 | list-style-type: none; } 241 | .item a[name]:before { 242 | content: ""; 243 | display: block; 244 | padding-top: 70px; 245 | margin: -70px 0 0; } 246 | .item code { 247 | background-color: transparent; 248 | padding: 0; } 249 | .item .token, .item .direct-link { 250 | display: inline-block; 251 | text-indent: -20px; 252 | padding-left: 3px; 253 | margin-left: 35px; 254 | font-size: 11.9px; 255 | transition: all 300ms; } 256 | .item .token-open { 257 | margin-left: 20px; } 258 | .item .discouraged { 259 | text-decoration: line-through; } 260 | .item .declaration-note { 261 | font-size: .85em; 262 | color: gray; 263 | font-style: italic; } 264 | 265 | .pointer-container { 266 | border-bottom: 1px solid #e2e2e2; 267 | left: -23px; 268 | padding-bottom: 13px; 269 | position: relative; 270 | width: 110%; } 271 | 272 | .pointer { 273 | background: #f9f9f9; 274 | border-left: 1px solid #e2e2e2; 275 | border-top: 1px solid #e2e2e2; 276 | height: 12px; 277 | left: 21px; 278 | top: -7px; 279 | -webkit-transform: rotate(45deg); 280 | -moz-transform: rotate(45deg); 281 | -o-transform: rotate(45deg); 282 | transform: rotate(45deg); 283 | position: absolute; 284 | width: 12px; } 285 | 286 | .height-container { 287 | display: none; 288 | left: -25px; 289 | padding: 0 25px; 290 | position: relative; 291 | width: 100%; 292 | overflow: hidden; } 293 | .height-container .section { 294 | background: #f9f9f9; 295 | border-bottom: 1px solid #e2e2e2; 296 | left: -25px; 297 | position: relative; 298 | width: 100%; 299 | padding-top: 10px; 300 | padding-bottom: 5px; } 301 | 302 | .aside, .language { 303 | padding: 6px 12px; 304 | margin: 12px 0; 305 | border-left: 5px solid #dddddd; 306 | overflow-y: hidden; } 307 | .aside .aside-title, .language .aside-title { 308 | font-size: 9px; 309 | letter-spacing: 2px; 310 | text-transform: uppercase; 311 | padding-bottom: 0; 312 | margin: 0; 313 | color: #aaa; 314 | -webkit-user-select: none; } 315 | .aside p:last-child, .language p:last-child { 316 | margin-bottom: 0; } 317 | 318 | .language { 319 | border-left: 5px solid #cde9f4; } 320 | .language .aside-title { 321 | color: #4b8afb; } 322 | 323 | .aside-warning, .aside-deprecated, .aside-unavailable { 324 | border-left: 5px solid #ff6666; } 325 | .aside-warning .aside-title, .aside-deprecated .aside-title, .aside-unavailable .aside-title { 326 | color: #ff0000; } 327 | 328 | .graybox { 329 | border-collapse: collapse; 330 | width: 100%; } 331 | .graybox p { 332 | margin: 0; 333 | word-break: break-word; 334 | min-width: 50px; } 335 | .graybox td { 336 | border: 1px solid #e2e2e2; 337 | padding: 5px 25px 5px 10px; 338 | vertical-align: middle; } 339 | .graybox tr td:first-of-type { 340 | text-align: right; 341 | padding: 7px; 342 | vertical-align: top; 343 | word-break: normal; 344 | width: 40px; } 345 | 346 | .slightly-smaller { 347 | font-size: 0.9em; } 348 | 349 | #footer { 350 | position: relative; 351 | top: 10px; 352 | bottom: 0px; 353 | margin-left: 25px; } 354 | #footer p { 355 | margin: 0; 356 | color: #aaa; 357 | font-size: 0.8em; } 358 | 359 | html.dash header, html.dash #breadcrumbs, html.dash .sidebar { 360 | display: none; } 361 | 362 | html.dash .main-content { 363 | width: 980px; 364 | margin-left: 0; 365 | border: none; 366 | width: 100%; 367 | top: 0; 368 | padding-bottom: 0; } 369 | 370 | html.dash .height-container { 371 | display: block; } 372 | 373 | html.dash .item .token { 374 | margin-left: 0; } 375 | 376 | html.dash .content-wrapper { 377 | width: auto; } 378 | 379 | html.dash #footer { 380 | position: static; } 381 | 382 | form[role=search] { 383 | float: right; } 384 | form[role=search] input { 385 | font: Helvetica, freesans, Arial, sans-serif; 386 | margin-top: 6px; 387 | font-size: 13px; 388 | line-height: 20px; 389 | padding: 0px 10px; 390 | border: none; 391 | border-radius: 1em; } 392 | .loading form[role=search] input { 393 | background: white url(../img/spinner.gif) center right 4px no-repeat; } 394 | form[role=search] .tt-menu { 395 | margin: 0; 396 | min-width: 300px; 397 | background: #fff; 398 | color: #333; 399 | border: 1px solid #e2e2e2; 400 | z-index: 4; } 401 | form[role=search] .tt-highlight { 402 | font-weight: bold; } 403 | form[role=search] .tt-suggestion { 404 | font: Helvetica, freesans, Arial, sans-serif; 405 | font-size: 14px; 406 | padding: 0 8px; } 407 | form[role=search] .tt-suggestion span { 408 | display: table-cell; 409 | white-space: nowrap; } 410 | form[role=search] .tt-suggestion .doc-parent-name { 411 | width: 100%; 412 | text-align: right; 413 | font-weight: normal; 414 | font-size: 0.9em; 415 | padding-left: 16px; } 416 | form[role=search] .tt-suggestion:hover, 417 | form[role=search] .tt-suggestion.tt-cursor { 418 | cursor: pointer; 419 | background-color: #4183c4; 420 | color: #fff; } 421 | form[role=search] .tt-suggestion:hover .doc-parent-name, 422 | form[role=search] .tt-suggestion.tt-cursor .doc-parent-name { 423 | color: #fff; } 424 | -------------------------------------------------------------------------------- /docs/docsets/RxReachability.docset/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIdentifier 6 | com.jazzy.rxreachability 7 | CFBundleName 8 | RxReachability 9 | DocSetPlatformFamily 10 | rxreachability 11 | isDashDocset 12 | 13 | dashIndexFilePath 14 | index.html 15 | isJavaScriptEnabled 16 | 17 | DashDocSetFamily 18 | dashtoc 19 | DashDocSetFallbackURL 20 | https://community.rxswift.org/RxReachability/ 21 | 22 | 23 | -------------------------------------------------------------------------------- /docs/docsets/RxReachability.docset/Contents/Resources/Documents/Extensions/ObservableType.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ObservableType Extension Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 |

RxReachability 1.2.1 Docs (100% documented)

21 |

View on GitHub

22 |

Install in Dash

23 |

24 |

25 | 26 |
27 |

28 |
29 |
30 |
31 | 36 |
37 |
38 | 61 |
62 |
63 |
64 |

ObservableType

65 |
66 |
67 | 68 |
public extension ObservableType
69 | 70 |
71 |
72 | 73 |
74 |
75 |
76 |
    77 |
  • 78 |
    79 | 80 | 81 | 82 | retryOnConnect(timeout:) 83 | 84 |
    85 |
    86 |
    87 |
    88 |
    89 |
    90 |

    An oberverable to execute retry and execute code on reconnect after a timeout timeout

    91 | 92 |
    93 |
    94 |

    Declaration

    95 |
    96 |

    Swift

    97 |
    func retryOnConnect(timeout: DispatchTimeInterval) -> Observable<Element>
    98 | 99 |
    100 |
    101 |
    102 |

    Parameters

    103 | 104 | 105 | 106 | 111 | 116 | 117 | 118 |
    107 | 108 | timeout 109 | 110 | 112 |
    113 |

    Seconds for timeout

    114 |
    115 |
    119 |
    120 |
    121 |

    Return Value

    122 |

    An observable sequence with a RxError.timeout in case of a timeout.

    123 |
    124 |
    125 | Show on GitHub 126 |
    127 |
    128 |
    129 |
  • 130 |
  • 131 |
    132 | 133 | 134 | 135 | retryOnConnect(timeout:predicate:) 136 | 137 |
    138 |
    139 |
    140 |
    141 |
    142 |
    143 |

    An filtered oberverable to execute retry and execute code on reconnect after a timeout timeout

    144 | 145 |
    146 |
    147 |

    Declaration

    148 |
    149 |

    Swift

    150 |
    func retryOnConnect(
    151 |   timeout: DispatchTimeInterval,
    152 |   predicate: @escaping (Swift.Error) -> Bool
    153 | ) -> Observable<Element>
    154 | 155 |
    156 |
    157 |
    158 |

    Parameters

    159 | 160 | 161 | 162 | 167 | 172 | 173 | 174 | 179 | 184 | 185 | 186 |
    163 | 164 | timeout 165 | 166 | 168 |
    169 |

    Seconds for timeout

    170 |
    171 |
    175 | 176 | predicate 177 | 178 | 180 |
    181 |

    A function to test each source element for a condition.

    182 |
    183 |
    187 |
    188 |
    189 |

    Return Value

    190 |

    An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete.

    191 |
    192 |
    193 | Show on GitHub 194 |
    195 |
    196 |
    197 |
  • 198 |
  • 199 |
    200 | 201 | 202 | 203 | retryLatestOnConnect(timeout:predicate:) 204 | 205 |
    206 |
    207 |
    208 |
    209 |
    210 |
    211 |

    An filtered oberverable to execute retry and execute code on reconnect after a timeout timeout

    212 | 213 |
    214 |
    215 |

    Declaration

    216 |
    217 |

    Swift

    218 |
    func retryLatestOnConnect(
    219 |   timeout: DispatchTimeInterval,
    220 |   predicate: @escaping (Swift.Error) -> Bool
    221 | ) -> Observable<Element>
    222 | 223 |
    224 |
    225 |
    226 |

    Parameters

    227 | 228 | 229 | 230 | 235 | 240 | 241 | 242 | 247 | 252 | 253 | 254 |
    231 | 232 | timeout 233 | 234 | 236 |
    237 |

    Seconds for timeout

    238 |
    239 |
    243 | 244 | predicate 245 | 246 | 248 |
    249 |

    A function to test each source element for a condition.

    250 |
    251 |
    255 |
    256 |
    257 |

    Return Value

    258 |

    An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences and that at any point in time produces the elements of the most recent inner observable sequence that has been received.

    259 |
    260 |
    261 | Show on GitHub 262 |
    263 |
    264 |
    265 |
  • 266 |
267 |
268 |
269 |
270 | 274 |
275 |
276 | 277 | 278 | 279 | -------------------------------------------------------------------------------- /docs/docsets/RxReachability.docset/Contents/Resources/Documents/Observable Factories.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Observable Factories Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 |

RxReachability 1.2.1 Docs (100% documented)

21 |

View on GitHub

22 |

Install in Dash

23 |

24 |

25 | 26 |
27 |

28 |
29 |
30 |
31 | 36 |
37 |
38 | 61 |
62 |
63 |
64 |

Observable Factories

65 | 66 |
67 |
68 |
69 |
    70 |
  • 71 |
    72 | 73 | 74 | 75 | Reachability 76 | 77 |
    78 |
    79 |
    80 |
    81 |
    82 |
    83 | 84 |
    85 |
    86 |

    Declaration

    87 |
    88 |

    Swift

    89 |
    extension Reachability: ReactiveCompatible
    90 | 91 |
    92 |
    93 |
    94 |
    95 |
  • 96 |
  • 97 |
    98 | 99 | 100 | 101 | ObservableType 102 | 103 |
    104 |
    105 |
    106 |
    107 |
    108 |
    109 | 110 | See more 111 |
    112 |
    113 |

    Declaration

    114 |
    115 |

    Swift

    116 |
    public extension ObservableType
    117 | 118 |
    119 |
    120 |
    121 |
    122 |
  • 123 |
124 |
125 |
126 |
127 | 131 |
132 |
133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /docs/docsets/RxReachability.docset/Contents/Resources/Documents/Observables.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Observables Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 |

RxReachability 1.2.1 Docs (100% documented)

21 |

View on GitHub

22 |

Install in Dash

23 |

24 |

25 | 26 |
27 |

28 |
29 |
30 |
31 | 36 |
37 |
38 | 61 |
62 |
63 |
64 |

Observables

65 | 66 |
67 |
68 |
69 |
    70 |
  • 71 |
    72 | 73 | 74 | 75 | Reactive 76 | 77 |
    78 |
    79 |
    80 |
    81 |
    82 |
    83 | 84 | See more 85 |
    86 |
    87 |

    Declaration

    88 |
    89 |

    Swift

    90 |
    public extension Reactive where Base: Reachability
    91 | 92 |
    93 |
    94 |
    95 |
    96 |
  • 97 |
98 |
99 |
100 |
101 | 105 |
106 |
107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /docs/docsets/RxReachability.docset/Contents/Resources/Documents/css/highlight.css: -------------------------------------------------------------------------------- 1 | /* Credit to https://gist.github.com/wataru420/2048287 */ 2 | .highlight { 3 | /* Comment */ 4 | /* Error */ 5 | /* Keyword */ 6 | /* Operator */ 7 | /* Comment.Multiline */ 8 | /* Comment.Preproc */ 9 | /* Comment.Single */ 10 | /* Comment.Special */ 11 | /* Generic.Deleted */ 12 | /* Generic.Deleted.Specific */ 13 | /* Generic.Emph */ 14 | /* Generic.Error */ 15 | /* Generic.Heading */ 16 | /* Generic.Inserted */ 17 | /* Generic.Inserted.Specific */ 18 | /* Generic.Output */ 19 | /* Generic.Prompt */ 20 | /* Generic.Strong */ 21 | /* Generic.Subheading */ 22 | /* Generic.Traceback */ 23 | /* Keyword.Constant */ 24 | /* Keyword.Declaration */ 25 | /* Keyword.Pseudo */ 26 | /* Keyword.Reserved */ 27 | /* Keyword.Type */ 28 | /* Literal.Number */ 29 | /* Literal.String */ 30 | /* Name.Attribute */ 31 | /* Name.Builtin */ 32 | /* Name.Class */ 33 | /* Name.Constant */ 34 | /* Name.Entity */ 35 | /* Name.Exception */ 36 | /* Name.Function */ 37 | /* Name.Namespace */ 38 | /* Name.Tag */ 39 | /* Name.Variable */ 40 | /* Operator.Word */ 41 | /* Text.Whitespace */ 42 | /* Literal.Number.Float */ 43 | /* Literal.Number.Hex */ 44 | /* Literal.Number.Integer */ 45 | /* Literal.Number.Oct */ 46 | /* Literal.String.Backtick */ 47 | /* Literal.String.Char */ 48 | /* Literal.String.Doc */ 49 | /* Literal.String.Double */ 50 | /* Literal.String.Escape */ 51 | /* Literal.String.Heredoc */ 52 | /* Literal.String.Interpol */ 53 | /* Literal.String.Other */ 54 | /* Literal.String.Regex */ 55 | /* Literal.String.Single */ 56 | /* Literal.String.Symbol */ 57 | /* Name.Builtin.Pseudo */ 58 | /* Name.Variable.Class */ 59 | /* Name.Variable.Global */ 60 | /* Name.Variable.Instance */ 61 | /* Literal.Number.Integer.Long */ } 62 | .highlight .c { 63 | color: #999988; 64 | font-style: italic; } 65 | .highlight .err { 66 | color: #a61717; 67 | background-color: #e3d2d2; } 68 | .highlight .k { 69 | color: #000000; 70 | font-weight: bold; } 71 | .highlight .o { 72 | color: #000000; 73 | font-weight: bold; } 74 | .highlight .cm { 75 | color: #999988; 76 | font-style: italic; } 77 | .highlight .cp { 78 | color: #999999; 79 | font-weight: bold; } 80 | .highlight .c1 { 81 | color: #999988; 82 | font-style: italic; } 83 | .highlight .cs { 84 | color: #999999; 85 | font-weight: bold; 86 | font-style: italic; } 87 | .highlight .gd { 88 | color: #000000; 89 | background-color: #ffdddd; } 90 | .highlight .gd .x { 91 | color: #000000; 92 | background-color: #ffaaaa; } 93 | .highlight .ge { 94 | color: #000000; 95 | font-style: italic; } 96 | .highlight .gr { 97 | color: #aa0000; } 98 | .highlight .gh { 99 | color: #999999; } 100 | .highlight .gi { 101 | color: #000000; 102 | background-color: #ddffdd; } 103 | .highlight .gi .x { 104 | color: #000000; 105 | background-color: #aaffaa; } 106 | .highlight .go { 107 | color: #888888; } 108 | .highlight .gp { 109 | color: #555555; } 110 | .highlight .gs { 111 | font-weight: bold; } 112 | .highlight .gu { 113 | color: #aaaaaa; } 114 | .highlight .gt { 115 | color: #aa0000; } 116 | .highlight .kc { 117 | color: #000000; 118 | font-weight: bold; } 119 | .highlight .kd { 120 | color: #000000; 121 | font-weight: bold; } 122 | .highlight .kp { 123 | color: #000000; 124 | font-weight: bold; } 125 | .highlight .kr { 126 | color: #000000; 127 | font-weight: bold; } 128 | .highlight .kt { 129 | color: #445588; } 130 | .highlight .m { 131 | color: #009999; } 132 | .highlight .s { 133 | color: #d14; } 134 | .highlight .na { 135 | color: #008080; } 136 | .highlight .nb { 137 | color: #0086B3; } 138 | .highlight .nc { 139 | color: #445588; 140 | font-weight: bold; } 141 | .highlight .no { 142 | color: #008080; } 143 | .highlight .ni { 144 | color: #800080; } 145 | .highlight .ne { 146 | color: #990000; 147 | font-weight: bold; } 148 | .highlight .nf { 149 | color: #990000; } 150 | .highlight .nn { 151 | color: #555555; } 152 | .highlight .nt { 153 | color: #000080; } 154 | .highlight .nv { 155 | color: #008080; } 156 | .highlight .ow { 157 | color: #000000; 158 | font-weight: bold; } 159 | .highlight .w { 160 | color: #bbbbbb; } 161 | .highlight .mf { 162 | color: #009999; } 163 | .highlight .mh { 164 | color: #009999; } 165 | .highlight .mi { 166 | color: #009999; } 167 | .highlight .mo { 168 | color: #009999; } 169 | .highlight .sb { 170 | color: #d14; } 171 | .highlight .sc { 172 | color: #d14; } 173 | .highlight .sd { 174 | color: #d14; } 175 | .highlight .s2 { 176 | color: #d14; } 177 | .highlight .se { 178 | color: #d14; } 179 | .highlight .sh { 180 | color: #d14; } 181 | .highlight .si { 182 | color: #d14; } 183 | .highlight .sx { 184 | color: #d14; } 185 | .highlight .sr { 186 | color: #009926; } 187 | .highlight .s1 { 188 | color: #d14; } 189 | .highlight .ss { 190 | color: #990073; } 191 | .highlight .bp { 192 | color: #999999; } 193 | .highlight .vc { 194 | color: #008080; } 195 | .highlight .vg { 196 | color: #008080; } 197 | .highlight .vi { 198 | color: #008080; } 199 | .highlight .il { 200 | color: #009999; } 201 | -------------------------------------------------------------------------------- /docs/docsets/RxReachability.docset/Contents/Resources/Documents/css/jazzy.css: -------------------------------------------------------------------------------- 1 | html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td { 2 | background: transparent; 3 | border: 0; 4 | margin: 0; 5 | outline: 0; 6 | padding: 0; 7 | vertical-align: baseline; } 8 | 9 | body { 10 | background-color: #f2f2f2; 11 | font-family: Helvetica, freesans, Arial, sans-serif; 12 | font-size: 14px; 13 | -webkit-font-smoothing: subpixel-antialiased; 14 | word-wrap: break-word; } 15 | 16 | h1, h2, h3 { 17 | margin-top: 0.8em; 18 | margin-bottom: 0.3em; 19 | font-weight: 100; 20 | color: black; } 21 | 22 | h1 { 23 | font-size: 2.5em; } 24 | 25 | h2 { 26 | font-size: 2em; 27 | border-bottom: 1px solid #e2e2e2; } 28 | 29 | h4 { 30 | font-size: 13px; 31 | line-height: 1.5; 32 | margin-top: 21px; } 33 | 34 | h5 { 35 | font-size: 1.1em; } 36 | 37 | h6 { 38 | font-size: 1.1em; 39 | color: #777; } 40 | 41 | .section-name { 42 | color: gray; 43 | display: block; 44 | font-family: Helvetica; 45 | font-size: 22px; 46 | font-weight: 100; 47 | margin-bottom: 15px; } 48 | 49 | pre, code { 50 | font: 0.95em Menlo, monospace; 51 | color: #777; 52 | word-wrap: normal; } 53 | 54 | p code, li code { 55 | background-color: #eee; 56 | padding: 2px 4px; 57 | border-radius: 4px; } 58 | 59 | pre > code { 60 | padding: 0; } 61 | 62 | a { 63 | color: #0088cc; 64 | text-decoration: none; } 65 | a code { 66 | color: inherit; } 67 | 68 | ul { 69 | padding-left: 15px; } 70 | 71 | li { 72 | line-height: 1.8em; } 73 | 74 | img { 75 | max-width: 100%; } 76 | 77 | blockquote { 78 | margin-left: 0; 79 | padding: 0 10px; 80 | border-left: 4px solid #ccc; } 81 | 82 | .content-wrapper { 83 | margin: 0 auto; 84 | width: 980px; } 85 | 86 | header { 87 | font-size: 0.85em; 88 | line-height: 32px; 89 | background-color: #414141; 90 | position: fixed; 91 | width: 100%; 92 | z-index: 3; } 93 | header img { 94 | padding-right: 6px; 95 | vertical-align: -4px; 96 | height: 16px; } 97 | header a { 98 | color: #fff; } 99 | header p { 100 | float: left; 101 | color: #999; } 102 | header .header-right { 103 | float: right; 104 | margin-left: 16px; } 105 | 106 | #breadcrumbs { 107 | background-color: #f2f2f2; 108 | height: 21px; 109 | padding-top: 17px; 110 | position: fixed; 111 | width: 100%; 112 | z-index: 2; 113 | margin-top: 32px; } 114 | #breadcrumbs #carat { 115 | height: 10px; 116 | margin: 0 5px; } 117 | 118 | .sidebar { 119 | background-color: #f9f9f9; 120 | border: 1px solid #e2e2e2; 121 | overflow-y: auto; 122 | overflow-x: hidden; 123 | position: fixed; 124 | top: 70px; 125 | bottom: 0; 126 | width: 230px; 127 | word-wrap: normal; } 128 | 129 | .nav-groups { 130 | list-style-type: none; 131 | background: #fff; 132 | padding-left: 0; } 133 | 134 | .nav-group-name { 135 | border-bottom: 1px solid #e2e2e2; 136 | font-size: 1.1em; 137 | font-weight: 100; 138 | padding: 15px 0 15px 20px; } 139 | .nav-group-name > a { 140 | color: #333; } 141 | 142 | .nav-group-tasks { 143 | margin-top: 5px; } 144 | 145 | .nav-group-task { 146 | font-size: 0.9em; 147 | list-style-type: none; 148 | white-space: nowrap; } 149 | .nav-group-task a { 150 | color: #888; } 151 | 152 | .main-content { 153 | background-color: #fff; 154 | border: 1px solid #e2e2e2; 155 | margin-left: 246px; 156 | position: absolute; 157 | overflow: hidden; 158 | padding-bottom: 20px; 159 | top: 70px; 160 | width: 734px; } 161 | .main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote { 162 | margin-bottom: 1em; } 163 | .main-content p { 164 | line-height: 1.8em; } 165 | .main-content section .section:first-child { 166 | margin-top: 0; 167 | padding-top: 0; } 168 | .main-content section .task-group-section .task-group:first-of-type { 169 | padding-top: 10px; } 170 | .main-content section .task-group-section .task-group:first-of-type .section-name { 171 | padding-top: 15px; } 172 | .main-content section .heading:before { 173 | content: ""; 174 | display: block; 175 | padding-top: 70px; 176 | margin: -70px 0 0; } 177 | .main-content .section-name p { 178 | margin-bottom: inherit; 179 | line-height: inherit; } 180 | .main-content .section-name code { 181 | background-color: inherit; 182 | padding: inherit; 183 | color: inherit; } 184 | 185 | .section { 186 | padding: 0 25px; } 187 | 188 | .highlight { 189 | background-color: #eee; 190 | padding: 10px 12px; 191 | border: 1px solid #e2e2e2; 192 | border-radius: 4px; 193 | overflow-x: auto; } 194 | 195 | .declaration .highlight { 196 | overflow-x: initial; 197 | padding: 0 40px 40px 0; 198 | margin-bottom: -25px; 199 | background-color: transparent; 200 | border: none; } 201 | 202 | .section-name { 203 | margin: 0; 204 | margin-left: 18px; } 205 | 206 | .task-group-section { 207 | margin-top: 10px; 208 | padding-left: 6px; 209 | border-top: 1px solid #e2e2e2; } 210 | 211 | .task-group { 212 | padding-top: 0px; } 213 | 214 | .task-name-container a[name]:before { 215 | content: ""; 216 | display: block; 217 | padding-top: 70px; 218 | margin: -70px 0 0; } 219 | 220 | .section-name-container { 221 | position: relative; 222 | display: inline-block; } 223 | .section-name-container .section-name-link { 224 | position: absolute; 225 | top: 0; 226 | left: 0; 227 | bottom: 0; 228 | right: 0; 229 | margin-bottom: 0; } 230 | .section-name-container .section-name { 231 | position: relative; 232 | pointer-events: none; 233 | z-index: 1; } 234 | .section-name-container .section-name a { 235 | pointer-events: auto; } 236 | 237 | .item { 238 | padding-top: 8px; 239 | width: 100%; 240 | list-style-type: none; } 241 | .item a[name]:before { 242 | content: ""; 243 | display: block; 244 | padding-top: 70px; 245 | margin: -70px 0 0; } 246 | .item code { 247 | background-color: transparent; 248 | padding: 0; } 249 | .item .token, .item .direct-link { 250 | display: inline-block; 251 | text-indent: -20px; 252 | padding-left: 3px; 253 | margin-left: 35px; 254 | font-size: 11.9px; 255 | transition: all 300ms; } 256 | .item .token-open { 257 | margin-left: 20px; } 258 | .item .discouraged { 259 | text-decoration: line-through; } 260 | .item .declaration-note { 261 | font-size: .85em; 262 | color: gray; 263 | font-style: italic; } 264 | 265 | .pointer-container { 266 | border-bottom: 1px solid #e2e2e2; 267 | left: -23px; 268 | padding-bottom: 13px; 269 | position: relative; 270 | width: 110%; } 271 | 272 | .pointer { 273 | background: #f9f9f9; 274 | border-left: 1px solid #e2e2e2; 275 | border-top: 1px solid #e2e2e2; 276 | height: 12px; 277 | left: 21px; 278 | top: -7px; 279 | -webkit-transform: rotate(45deg); 280 | -moz-transform: rotate(45deg); 281 | -o-transform: rotate(45deg); 282 | transform: rotate(45deg); 283 | position: absolute; 284 | width: 12px; } 285 | 286 | .height-container { 287 | display: none; 288 | left: -25px; 289 | padding: 0 25px; 290 | position: relative; 291 | width: 100%; 292 | overflow: hidden; } 293 | .height-container .section { 294 | background: #f9f9f9; 295 | border-bottom: 1px solid #e2e2e2; 296 | left: -25px; 297 | position: relative; 298 | width: 100%; 299 | padding-top: 10px; 300 | padding-bottom: 5px; } 301 | 302 | .aside, .language { 303 | padding: 6px 12px; 304 | margin: 12px 0; 305 | border-left: 5px solid #dddddd; 306 | overflow-y: hidden; } 307 | .aside .aside-title, .language .aside-title { 308 | font-size: 9px; 309 | letter-spacing: 2px; 310 | text-transform: uppercase; 311 | padding-bottom: 0; 312 | margin: 0; 313 | color: #aaa; 314 | -webkit-user-select: none; } 315 | .aside p:last-child, .language p:last-child { 316 | margin-bottom: 0; } 317 | 318 | .language { 319 | border-left: 5px solid #cde9f4; } 320 | .language .aside-title { 321 | color: #4b8afb; } 322 | 323 | .aside-warning, .aside-deprecated, .aside-unavailable { 324 | border-left: 5px solid #ff6666; } 325 | .aside-warning .aside-title, .aside-deprecated .aside-title, .aside-unavailable .aside-title { 326 | color: #ff0000; } 327 | 328 | .graybox { 329 | border-collapse: collapse; 330 | width: 100%; } 331 | .graybox p { 332 | margin: 0; 333 | word-break: break-word; 334 | min-width: 50px; } 335 | .graybox td { 336 | border: 1px solid #e2e2e2; 337 | padding: 5px 25px 5px 10px; 338 | vertical-align: middle; } 339 | .graybox tr td:first-of-type { 340 | text-align: right; 341 | padding: 7px; 342 | vertical-align: top; 343 | word-break: normal; 344 | width: 40px; } 345 | 346 | .slightly-smaller { 347 | font-size: 0.9em; } 348 | 349 | #footer { 350 | position: relative; 351 | top: 10px; 352 | bottom: 0px; 353 | margin-left: 25px; } 354 | #footer p { 355 | margin: 0; 356 | color: #aaa; 357 | font-size: 0.8em; } 358 | 359 | html.dash header, html.dash #breadcrumbs, html.dash .sidebar { 360 | display: none; } 361 | 362 | html.dash .main-content { 363 | width: 980px; 364 | margin-left: 0; 365 | border: none; 366 | width: 100%; 367 | top: 0; 368 | padding-bottom: 0; } 369 | 370 | html.dash .height-container { 371 | display: block; } 372 | 373 | html.dash .item .token { 374 | margin-left: 0; } 375 | 376 | html.dash .content-wrapper { 377 | width: auto; } 378 | 379 | html.dash #footer { 380 | position: static; } 381 | 382 | form[role=search] { 383 | float: right; } 384 | form[role=search] input { 385 | font: Helvetica, freesans, Arial, sans-serif; 386 | margin-top: 6px; 387 | font-size: 13px; 388 | line-height: 20px; 389 | padding: 0px 10px; 390 | border: none; 391 | border-radius: 1em; } 392 | .loading form[role=search] input { 393 | background: white url(../img/spinner.gif) center right 4px no-repeat; } 394 | form[role=search] .tt-menu { 395 | margin: 0; 396 | min-width: 300px; 397 | background: #fff; 398 | color: #333; 399 | border: 1px solid #e2e2e2; 400 | z-index: 4; } 401 | form[role=search] .tt-highlight { 402 | font-weight: bold; } 403 | form[role=search] .tt-suggestion { 404 | font: Helvetica, freesans, Arial, sans-serif; 405 | font-size: 14px; 406 | padding: 0 8px; } 407 | form[role=search] .tt-suggestion span { 408 | display: table-cell; 409 | white-space: nowrap; } 410 | form[role=search] .tt-suggestion .doc-parent-name { 411 | width: 100%; 412 | text-align: right; 413 | font-weight: normal; 414 | font-size: 0.9em; 415 | padding-left: 16px; } 416 | form[role=search] .tt-suggestion:hover, 417 | form[role=search] .tt-suggestion.tt-cursor { 418 | cursor: pointer; 419 | background-color: #4183c4; 420 | color: #fff; } 421 | form[role=search] .tt-suggestion:hover .doc-parent-name, 422 | form[role=search] .tt-suggestion.tt-cursor .doc-parent-name { 423 | color: #fff; } 424 | -------------------------------------------------------------------------------- /docs/docsets/RxReachability.docset/Contents/Resources/Documents/img/carat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RxSwiftCommunity/RxReachability/96c07f7cc596ac6651c5628b0e7c0d776c99d8da/docs/docsets/RxReachability.docset/Contents/Resources/Documents/img/carat.png -------------------------------------------------------------------------------- /docs/docsets/RxReachability.docset/Contents/Resources/Documents/img/dash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RxSwiftCommunity/RxReachability/96c07f7cc596ac6651c5628b0e7c0d776c99d8da/docs/docsets/RxReachability.docset/Contents/Resources/Documents/img/dash.png -------------------------------------------------------------------------------- /docs/docsets/RxReachability.docset/Contents/Resources/Documents/img/gh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RxSwiftCommunity/RxReachability/96c07f7cc596ac6651c5628b0e7c0d776c99d8da/docs/docsets/RxReachability.docset/Contents/Resources/Documents/img/gh.png -------------------------------------------------------------------------------- /docs/docsets/RxReachability.docset/Contents/Resources/Documents/img/spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RxSwiftCommunity/RxReachability/96c07f7cc596ac6651c5628b0e7c0d776c99d8da/docs/docsets/RxReachability.docset/Contents/Resources/Documents/img/spinner.gif -------------------------------------------------------------------------------- /docs/docsets/RxReachability.docset/Contents/Resources/Documents/js/jazzy.js: -------------------------------------------------------------------------------- 1 | window.jazzy = {'docset': false} 2 | if (typeof window.dash != 'undefined') { 3 | document.documentElement.className += ' dash' 4 | window.jazzy.docset = true 5 | } 6 | if (navigator.userAgent.match(/xcode/i)) { 7 | document.documentElement.className += ' xcode' 8 | window.jazzy.docset = true 9 | } 10 | 11 | function toggleItem($link, $content) { 12 | var animationDuration = 300; 13 | $link.toggleClass('token-open'); 14 | $content.slideToggle(animationDuration); 15 | } 16 | 17 | function itemLinkToContent($link) { 18 | return $link.parent().parent().next(); 19 | } 20 | 21 | // On doc load + hash-change, open any targetted item 22 | function openCurrentItemIfClosed() { 23 | if (window.jazzy.docset) { 24 | return; 25 | } 26 | var $link = $(`a[name="${location.hash.substring(1)}"]`).nextAll('.token'); 27 | $content = itemLinkToContent($link); 28 | if ($content.is(':hidden')) { 29 | toggleItem($link, $content); 30 | } 31 | } 32 | 33 | $(openCurrentItemIfClosed); 34 | $(window).on('hashchange', openCurrentItemIfClosed); 35 | 36 | // On item link ('token') click, toggle its discussion 37 | $('.token').on('click', function(event) { 38 | if (window.jazzy.docset) { 39 | return; 40 | } 41 | var $link = $(this); 42 | toggleItem($link, itemLinkToContent($link)); 43 | 44 | // Keeps the document from jumping to the hash. 45 | var href = $link.attr('href'); 46 | if (history.pushState) { 47 | history.pushState({}, '', href); 48 | } else { 49 | location.hash = href; 50 | } 51 | event.preventDefault(); 52 | }); 53 | 54 | // Clicks on links to the current, closed, item need to open the item 55 | $("a:not('.token')").on('click', function() { 56 | if (location == this.href) { 57 | openCurrentItemIfClosed(); 58 | } 59 | }); 60 | 61 | // KaTeX rendering 62 | if ("katex" in window) { 63 | $($('.math').each( (_, element) => { 64 | katex.render(element.textContent, element, { 65 | displayMode: $(element).hasClass('m-block'), 66 | throwOnError: false, 67 | trust: true 68 | }); 69 | })) 70 | } 71 | -------------------------------------------------------------------------------- /docs/docsets/RxReachability.docset/Contents/Resources/Documents/js/jazzy.search.js: -------------------------------------------------------------------------------- 1 | $(function(){ 2 | var $typeahead = $('[data-typeahead]'); 3 | var $form = $typeahead.parents('form'); 4 | var searchURL = $form.attr('action'); 5 | 6 | function displayTemplate(result) { 7 | return result.name; 8 | } 9 | 10 | function suggestionTemplate(result) { 11 | var t = '
'; 12 | t += '' + result.name + ''; 13 | if (result.parent_name) { 14 | t += '' + result.parent_name + ''; 15 | } 16 | t += '
'; 17 | return t; 18 | } 19 | 20 | $typeahead.one('focus', function() { 21 | $form.addClass('loading'); 22 | 23 | $.getJSON(searchURL).then(function(searchData) { 24 | const searchIndex = lunr(function() { 25 | this.ref('url'); 26 | this.field('name'); 27 | this.field('abstract'); 28 | for (const [url, doc] of Object.entries(searchData)) { 29 | this.add({url: url, name: doc.name, abstract: doc.abstract}); 30 | } 31 | }); 32 | 33 | $typeahead.typeahead( 34 | { 35 | highlight: true, 36 | minLength: 3, 37 | autoselect: true 38 | }, 39 | { 40 | limit: 10, 41 | display: displayTemplate, 42 | templates: { suggestion: suggestionTemplate }, 43 | source: function(query, sync) { 44 | const lcSearch = query.toLowerCase(); 45 | const results = searchIndex.query(function(q) { 46 | q.term(lcSearch, { boost: 100 }); 47 | q.term(lcSearch, { 48 | boost: 10, 49 | wildcard: lunr.Query.wildcard.TRAILING 50 | }); 51 | }).map(function(result) { 52 | var doc = searchData[result.ref]; 53 | doc.url = result.ref; 54 | return doc; 55 | }); 56 | sync(results); 57 | } 58 | } 59 | ); 60 | $form.removeClass('loading'); 61 | $typeahead.trigger('focus'); 62 | }); 63 | }); 64 | 65 | var baseURL = searchURL.slice(0, -"search.json".length); 66 | 67 | $typeahead.on('typeahead:select', function(e, result) { 68 | window.location = baseURL + result.url; 69 | }); 70 | }); 71 | -------------------------------------------------------------------------------- /docs/docsets/RxReachability.docset/Contents/Resources/Documents/search.json: -------------------------------------------------------------------------------- 1 | {"Extensions/ObservableType.html#/s:7RxSwift14ObservableTypeP0A12ReachabilityE14retryOnConnect7timeoutAA0C0Cy7ElementQzG8Dispatch0K12TimeIntervalO_tF":{"name":"retryOnConnect(timeout:)","abstract":"

An oberverable to execute retry and execute code on reconnect after a timeout timeout

","parent_name":"ObservableType"},"Extensions/ObservableType.html#/s:7RxSwift14ObservableTypeP0A12ReachabilityE14retryOnConnect7timeout9predicateAA0C0Cy7ElementQzG8Dispatch0L12TimeIntervalO_Sbs5Error_pctF":{"name":"retryOnConnect(timeout:predicate:)","abstract":"

An filtered oberverable to execute retry and execute code on reconnect after a timeout timeout

","parent_name":"ObservableType"},"Extensions/ObservableType.html#/s:7RxSwift14ObservableTypeP0A12ReachabilityE20retryLatestOnConnect7timeout9predicateAA0C0Cy7ElementQzG8Dispatch0M12TimeIntervalO_Sbs5Error_pctF":{"name":"retryLatestOnConnect(timeout:predicate:)","abstract":"

An filtered oberverable to execute retry and execute code on reconnect after a timeout timeout

","parent_name":"ObservableType"},"Observable%20Factories.html#/s:12ReachabilityAAC":{"name":"Reachability"},"Extensions/ObservableType.html":{"name":"ObservableType"},"Extensions/Reactive.html#/s:7RxSwift8ReactiveV0A12Reachability0D0AECRbzlE19reachabilityChangedAA10ObservableCyAFGvpZ":{"name":"reachabilityChanged","abstract":"

Global to observe when Reachability status changes.

","parent_name":"Reactive"},"Extensions/Reactive.html#/s:7RxSwift8ReactiveV0A12Reachability0D0AECRbzlE6statusAA10ObservableCyAF10ConnectionOGvpZ":{"name":"status","abstract":"

Global to observe when Reachability.Connection status changes.

","parent_name":"Reactive"},"Extensions/Reactive.html#/s:7RxSwift8ReactiveV0A12Reachability0D0AECRbzlE11isReachableAA10ObservableCySbGvpZ":{"name":"isReachable","abstract":"

Global to observe a Bool when Reachability.Connection != .unavailable .

","parent_name":"Reactive"},"Extensions/Reactive.html#/s:7RxSwift8ReactiveV0A12Reachability0D0AECRbzlE11isConnectedAA10ObservableCyytGvpZ":{"name":"isConnected","abstract":"

Global to observe a Void when Reachability.Connection != .unavailable .

","parent_name":"Reactive"},"Extensions/Reactive.html#/s:7RxSwift8ReactiveV0A12Reachability0D0AECRbzlE14isDisconnectedAA10ObservableCyytGvpZ":{"name":"isDisconnected","abstract":"

Global to observe a Void when Reachability.Connection == .unavailable .

","parent_name":"Reactive"},"Extensions/Reactive.html#/s:7RxSwift8ReactiveV0A12Reachability0D0AECRbzlE19reachabilityChangedAA10ObservableCyAFGvp":{"name":"reachabilityChanged","abstract":"

Rx Observable to observe when Reachability status changes.

","parent_name":"Reactive"},"Extensions/Reactive.html#/s:7RxSwift8ReactiveV0A12Reachability0D0AECRbzlE6statusAA10ObservableCyAF10ConnectionOGvp":{"name":"status","abstract":"

Rx Observable to observe when Reachability.Connection value changes.

","parent_name":"Reactive"},"Extensions/Reactive.html#/s:7RxSwift8ReactiveV0A12Reachability0D0AECRbzlE11isReachableAA10ObservableCySbGvp":{"name":"isReachable","abstract":"

Instance variable to observe a Bool when Reachability.Connection != .unavailable .

","parent_name":"Reactive"},"Extensions/Reactive.html#/s:7RxSwift8ReactiveV0A12Reachability0D0AECRbzlE11isConnectedAA10ObservableCyytGvp":{"name":"isConnected","abstract":"

Instance variable to observe a Void when Reachability.Connection != .unavailable .

","parent_name":"Reactive"},"Extensions/Reactive.html#/s:7RxSwift8ReactiveV0A12Reachability0D0AECRbzlE14isDisconnectedAA10ObservableCyytGvp":{"name":"isDisconnected","abstract":"

Instance variable to observe a Void when Reachability.Connection == .unavailable .

","parent_name":"Reactive"},"Extensions/Reactive.html":{"name":"Reactive"},"Observables.html":{"name":"Observables"},"Observable%20Factories.html":{"name":"Observable Factories"}} -------------------------------------------------------------------------------- /docs/docsets/RxReachability.docset/Contents/Resources/docSet.dsidx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RxSwiftCommunity/RxReachability/96c07f7cc596ac6651c5628b0e7c0d776c99d8da/docs/docsets/RxReachability.docset/Contents/Resources/docSet.dsidx -------------------------------------------------------------------------------- /docs/docsets/RxReachability.docset/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RxSwiftCommunity/RxReachability/96c07f7cc596ac6651c5628b0e7c0d776c99d8da/docs/docsets/RxReachability.docset/icon.png -------------------------------------------------------------------------------- /docs/docsets/RxReachability.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RxSwiftCommunity/RxReachability/96c07f7cc596ac6651c5628b0e7c0d776c99d8da/docs/docsets/RxReachability.tgz -------------------------------------------------------------------------------- /docs/docsets/RxReachability.xml: -------------------------------------------------------------------------------- 1 | 1.2.1https://community.rxswift.org/RxReachability/docsets/RxReachability.tgz 2 | -------------------------------------------------------------------------------- /docs/img/carat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RxSwiftCommunity/RxReachability/96c07f7cc596ac6651c5628b0e7c0d776c99d8da/docs/img/carat.png -------------------------------------------------------------------------------- /docs/img/dash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RxSwiftCommunity/RxReachability/96c07f7cc596ac6651c5628b0e7c0d776c99d8da/docs/img/dash.png -------------------------------------------------------------------------------- /docs/img/gh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RxSwiftCommunity/RxReachability/96c07f7cc596ac6651c5628b0e7c0d776c99d8da/docs/img/gh.png -------------------------------------------------------------------------------- /docs/img/spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RxSwiftCommunity/RxReachability/96c07f7cc596ac6651c5628b0e7c0d776c99d8da/docs/img/spinner.gif -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | RxReachability Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 |
19 |

RxReachability 1.2.1 Docs (100% documented)

20 |

View on GitHub

21 |

Install in Dash

22 |

23 |

24 | 25 |
26 |

27 |
28 |
29 |
30 | 35 |
36 |
37 | 60 |
61 |
62 |
63 | 64 |

Logo

65 |

RxReachability

66 | 67 |

GitHub release 68 | Version 69 | License 70 | Platform 71 | Build Status 72 | Test Coverage

73 | 74 |

RxReachability adds easy to use RxSwift bindings for ReachabilitySwift. 75 | You can react to network reachability changes and even retry observables when network comes back up.

76 |

Available APIs

77 | 78 |

RxReachability adds the following RxSwift bindings:

79 | 80 |
    81 |
  • reachabilityChanged: Observable<Reachability>
  • 82 |
  • status: Observable<Reachability.NetworkStatus>
  • 83 |
  • isReachable: Observable<Bool>
  • 84 |
  • isConnected: Observable<Void>
  • 85 |
  • isDisconnected: Observable<Void>
  • 86 |
87 |

Common Usage

88 |

1. Be sure to store an instance of Reachability in your ViewController or similar, and start/stop the notifier on viewWillAppear and viewWillDisappear methods.

89 |
class ViewController: UIViewController {
 90 | 
 91 |   let disposeBag = DisposeBag()
 92 |   var reachability: Reachability?
 93 | 
 94 |   override func viewDidLoad() {
 95 |     super.viewDidLoad()
 96 |     reachability = Reachability()
 97 |   }
 98 | 
 99 |   override func viewWillAppear(_ animated: Bool) {
100 |     super.viewWillAppear(animated)
101 |     try? reachability?.startNotifier()
102 |   }
103 | 
104 |   override func viewWillDisappear(_ animated: Bool) {
105 |     super.viewWillDisappear(animated)
106 |     reachability?.stopNotifier()
107 |   }
108 | }
109 | 
110 | 
111 |

2. Subscribe to any of the bindings to know when a change happens.

112 |
extension ViewController {
113 | 
114 |   let disposeBag = DisposeBag()
115 | 
116 |   func bindReachability() {
117 | 
118 |     reachability?.rx.reachabilityChanged
119 |       .subscribe(onNext: { reachability: Reachability in
120 |         print("Reachability changed: \(reachability.currentReachabilityStatus)")
121 |       })
122 |       .disposed(by: disposeBag)
123 | 
124 |     reachability?.rx.status
125 |       .subscribe(onNext: { status: Reachability.NetworkStatus in
126 |         print("Reachability status changed: \(status)")
127 |       })
128 |       .disposed(by: disposeBag)
129 | 
130 |     reachability?.rx.isReachable
131 |       .subscribe(onNext: { isReachable: Bool in
132 |         print("Is reachable: \(isReachable)")
133 |       })
134 |       .disposed(by: disposeBag)
135 | 
136 |     reachability?.rx.isConnected
137 |       .subscribe(onNext: {
138 |         print("Is connected")
139 |       })
140 |       .disposed(by: disposeBag)
141 | 
142 |     reachability?.rx.isDisconnected
143 |       .subscribe(onNext: {
144 |         print("Is disconnected")
145 |       })
146 |       .disposed(by: disposeBag)
147 |   }
148 | 
149 |

Static Usage

150 |

1. Be sure to store an instance of Reachability somewhere on your AppDelegate or similar, and start the notifier.

151 |
import Reachability
152 | 
153 | @UIApplicationMain
154 | class AppDelegate: UIResponder, UIApplicationDelegate {
155 | 
156 |   var reachability: Reachability?
157 | 
158 |   func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
159 |     reachability = Reachability()
160 |     try? reachability?.startNotifier()
161 |     return true
162 |   }
163 | }
164 | 
165 | 
166 |

2. Subscribe to any of the bindings to know when a change happens.

167 |
import Reachability
168 | import RxReachability
169 | import RxSwift
170 | 
171 | class ViewController: UIViewController {
172 | 
173 |   let disposeBag = DisposeBag()
174 | 
175 |   override func viewDidLoad() {
176 |     super.viewDidLoad()
177 | 
178 |     Reachability.rx.reachabilityChanged
179 |       .subscribe(onNext: { reachability: Reachability in
180 |         print("Reachability changed: \(reachability.currrentReachabilityStatus)")
181 |       })
182 |       .disposed(by: disposeBag)
183 | 
184 |     Reachability.rx.status
185 |       .subscribe(onNext: { status: Reachability.NetworkStatus in
186 |         print("Reachability status changed: \(status)")
187 |       })
188 |       .disposed(by: disposeBag)
189 | 
190 |     Reachability.rx.isReachable
191 |       .subscribe(onNext: { isReachable: Bool in
192 |         print("Is reachable: \(isReachable)")
193 |       })
194 |       .disposed(by: disposeBag)
195 | 
196 |     Reachability.rx.isConnected
197 |       .subscribe(onNext: {
198 |         print("Is connected")
199 |       })
200 |       .disposed(by: disposeBag)
201 | 
202 |     Reachability.rx.isDisconnected
203 |       .subscribe(onNext: {
204 |         print("Is disconnected")
205 |       })
206 |       .disposed(by: disposeBag)
207 |   }
208 | 
209 |

Advanced Usage

210 | 211 |

With RxReachability you can also add a retry when network comes back up with a given timeout. 212 | This does require you to have a stored instance of Reachability though.

213 |
func request(somethingId: Int) -> Observable<Something> {
214 |   return network.request(.something(somethingId))
215 |     .retryOnConnect(timeout: 30)
216 |     .map { Something(JSON: $0) }
217 | }
218 | 
219 |

Installation

220 |

Installation via CocoaPods

221 | 222 |

To integrate RxReachability into your Xcode project using CocoaPods, simply add the following line to your Podfile:

223 |
pod 'RxReachability', ~> '1.2.1'
224 | 
225 |

Installation via Carthage

226 | 227 |

To integrate RxReachability into your Xcode project using CocoaPods, simply add the following line to your Cartfile:

228 |
github RxSwiftCommunity/RxReachability ~> 1.2.1
229 | 
230 |

Installation via Swift Package Manager (SPM)

231 | 232 |

To integrate RxReachability into your Xcode project using SPM, simply add the following line to your Package.swift:

233 |
.package(url: "https://github.com/RxSwiftCommunity/RxReachability", .upToNextMajor(from: "1.2.1")),
234 | 
235 |

Example

236 | 237 |

To run the example project, clone the repo, and run pod install from the Example directory first.

238 |

License

239 | 240 |

This library belongs to RxSwiftCommunity.

241 | 242 |

RxReachability is available under the MIT license. See the LICENSE file for more info.

243 | 244 |
245 |
246 | 250 |
251 |
252 | 253 | 254 | 255 | -------------------------------------------------------------------------------- /docs/js/jazzy.js: -------------------------------------------------------------------------------- 1 | window.jazzy = {'docset': false} 2 | if (typeof window.dash != 'undefined') { 3 | document.documentElement.className += ' dash' 4 | window.jazzy.docset = true 5 | } 6 | if (navigator.userAgent.match(/xcode/i)) { 7 | document.documentElement.className += ' xcode' 8 | window.jazzy.docset = true 9 | } 10 | 11 | function toggleItem($link, $content) { 12 | var animationDuration = 300; 13 | $link.toggleClass('token-open'); 14 | $content.slideToggle(animationDuration); 15 | } 16 | 17 | function itemLinkToContent($link) { 18 | return $link.parent().parent().next(); 19 | } 20 | 21 | // On doc load + hash-change, open any targetted item 22 | function openCurrentItemIfClosed() { 23 | if (window.jazzy.docset) { 24 | return; 25 | } 26 | var $link = $(`a[name="${location.hash.substring(1)}"]`).nextAll('.token'); 27 | $content = itemLinkToContent($link); 28 | if ($content.is(':hidden')) { 29 | toggleItem($link, $content); 30 | } 31 | } 32 | 33 | $(openCurrentItemIfClosed); 34 | $(window).on('hashchange', openCurrentItemIfClosed); 35 | 36 | // On item link ('token') click, toggle its discussion 37 | $('.token').on('click', function(event) { 38 | if (window.jazzy.docset) { 39 | return; 40 | } 41 | var $link = $(this); 42 | toggleItem($link, itemLinkToContent($link)); 43 | 44 | // Keeps the document from jumping to the hash. 45 | var href = $link.attr('href'); 46 | if (history.pushState) { 47 | history.pushState({}, '', href); 48 | } else { 49 | location.hash = href; 50 | } 51 | event.preventDefault(); 52 | }); 53 | 54 | // Clicks on links to the current, closed, item need to open the item 55 | $("a:not('.token')").on('click', function() { 56 | if (location == this.href) { 57 | openCurrentItemIfClosed(); 58 | } 59 | }); 60 | 61 | // KaTeX rendering 62 | if ("katex" in window) { 63 | $($('.math').each( (_, element) => { 64 | katex.render(element.textContent, element, { 65 | displayMode: $(element).hasClass('m-block'), 66 | throwOnError: false, 67 | trust: true 68 | }); 69 | })) 70 | } 71 | -------------------------------------------------------------------------------- /docs/js/jazzy.search.js: -------------------------------------------------------------------------------- 1 | $(function(){ 2 | var $typeahead = $('[data-typeahead]'); 3 | var $form = $typeahead.parents('form'); 4 | var searchURL = $form.attr('action'); 5 | 6 | function displayTemplate(result) { 7 | return result.name; 8 | } 9 | 10 | function suggestionTemplate(result) { 11 | var t = '
'; 12 | t += '' + result.name + ''; 13 | if (result.parent_name) { 14 | t += '' + result.parent_name + ''; 15 | } 16 | t += '
'; 17 | return t; 18 | } 19 | 20 | $typeahead.one('focus', function() { 21 | $form.addClass('loading'); 22 | 23 | $.getJSON(searchURL).then(function(searchData) { 24 | const searchIndex = lunr(function() { 25 | this.ref('url'); 26 | this.field('name'); 27 | this.field('abstract'); 28 | for (const [url, doc] of Object.entries(searchData)) { 29 | this.add({url: url, name: doc.name, abstract: doc.abstract}); 30 | } 31 | }); 32 | 33 | $typeahead.typeahead( 34 | { 35 | highlight: true, 36 | minLength: 3, 37 | autoselect: true 38 | }, 39 | { 40 | limit: 10, 41 | display: displayTemplate, 42 | templates: { suggestion: suggestionTemplate }, 43 | source: function(query, sync) { 44 | const lcSearch = query.toLowerCase(); 45 | const results = searchIndex.query(function(q) { 46 | q.term(lcSearch, { boost: 100 }); 47 | q.term(lcSearch, { 48 | boost: 10, 49 | wildcard: lunr.Query.wildcard.TRAILING 50 | }); 51 | }).map(function(result) { 52 | var doc = searchData[result.ref]; 53 | doc.url = result.ref; 54 | return doc; 55 | }); 56 | sync(results); 57 | } 58 | } 59 | ); 60 | $form.removeClass('loading'); 61 | $typeahead.trigger('focus'); 62 | }); 63 | }); 64 | 65 | var baseURL = searchURL.slice(0, -"search.json".length); 66 | 67 | $typeahead.on('typeahead:select', function(e, result) { 68 | window.location = baseURL + result.url; 69 | }); 70 | }); 71 | -------------------------------------------------------------------------------- /docs/search.json: -------------------------------------------------------------------------------- 1 | {"Extensions/ObservableType.html#/s:7RxSwift14ObservableTypeP0A12ReachabilityE14retryOnConnect7timeoutAA0C0Cy7ElementQzG8Dispatch0K12TimeIntervalO_tF":{"name":"retryOnConnect(timeout:)","abstract":"

An oberverable to execute retry and execute code on reconnect after a timeout timeout

","parent_name":"ObservableType"},"Extensions/ObservableType.html#/s:7RxSwift14ObservableTypeP0A12ReachabilityE14retryOnConnect7timeout9predicateAA0C0Cy7ElementQzG8Dispatch0L12TimeIntervalO_Sbs5Error_pctF":{"name":"retryOnConnect(timeout:predicate:)","abstract":"

An filtered oberverable to execute retry and execute code on reconnect after a timeout timeout

","parent_name":"ObservableType"},"Extensions/ObservableType.html#/s:7RxSwift14ObservableTypeP0A12ReachabilityE20retryLatestOnConnect7timeout9predicateAA0C0Cy7ElementQzG8Dispatch0M12TimeIntervalO_Sbs5Error_pctF":{"name":"retryLatestOnConnect(timeout:predicate:)","abstract":"

An filtered oberverable to execute retry and execute code on reconnect after a timeout timeout

","parent_name":"ObservableType"},"Observable%20Factories.html#/s:12ReachabilityAAC":{"name":"Reachability"},"Extensions/ObservableType.html":{"name":"ObservableType"},"Extensions/Reactive.html#/s:7RxSwift8ReactiveV0A12Reachability0D0AECRbzlE19reachabilityChangedAA10ObservableCyAFGvpZ":{"name":"reachabilityChanged","abstract":"

Global to observe when Reachability status changes.

","parent_name":"Reactive"},"Extensions/Reactive.html#/s:7RxSwift8ReactiveV0A12Reachability0D0AECRbzlE6statusAA10ObservableCyAF10ConnectionOGvpZ":{"name":"status","abstract":"

Global to observe when Reachability.Connection status changes.

","parent_name":"Reactive"},"Extensions/Reactive.html#/s:7RxSwift8ReactiveV0A12Reachability0D0AECRbzlE11isReachableAA10ObservableCySbGvpZ":{"name":"isReachable","abstract":"

Global to observe a Bool when Reachability.Connection != .unavailable .

","parent_name":"Reactive"},"Extensions/Reactive.html#/s:7RxSwift8ReactiveV0A12Reachability0D0AECRbzlE11isConnectedAA10ObservableCyytGvpZ":{"name":"isConnected","abstract":"

Global to observe a Void when Reachability.Connection != .unavailable .

","parent_name":"Reactive"},"Extensions/Reactive.html#/s:7RxSwift8ReactiveV0A12Reachability0D0AECRbzlE14isDisconnectedAA10ObservableCyytGvpZ":{"name":"isDisconnected","abstract":"

Global to observe a Void when Reachability.Connection == .unavailable .

","parent_name":"Reactive"},"Extensions/Reactive.html#/s:7RxSwift8ReactiveV0A12Reachability0D0AECRbzlE19reachabilityChangedAA10ObservableCyAFGvp":{"name":"reachabilityChanged","abstract":"

Rx Observable to observe when Reachability status changes.

","parent_name":"Reactive"},"Extensions/Reactive.html#/s:7RxSwift8ReactiveV0A12Reachability0D0AECRbzlE6statusAA10ObservableCyAF10ConnectionOGvp":{"name":"status","abstract":"

Rx Observable to observe when Reachability.Connection value changes.

","parent_name":"Reactive"},"Extensions/Reactive.html#/s:7RxSwift8ReactiveV0A12Reachability0D0AECRbzlE11isReachableAA10ObservableCySbGvp":{"name":"isReachable","abstract":"

Instance variable to observe a Bool when Reachability.Connection != .unavailable .

","parent_name":"Reactive"},"Extensions/Reactive.html#/s:7RxSwift8ReactiveV0A12Reachability0D0AECRbzlE11isConnectedAA10ObservableCyytGvp":{"name":"isConnected","abstract":"

Instance variable to observe a Void when Reachability.Connection != .unavailable .

","parent_name":"Reactive"},"Extensions/Reactive.html#/s:7RxSwift8ReactiveV0A12Reachability0D0AECRbzlE14isDisconnectedAA10ObservableCyytGvp":{"name":"isDisconnected","abstract":"

Instance variable to observe a Void when Reachability.Connection == .unavailable .

","parent_name":"Reactive"},"Extensions/Reactive.html":{"name":"Reactive"},"Observables.html":{"name":"Observables"},"Observable%20Factories.html":{"name":"Observable Factories"}} -------------------------------------------------------------------------------- /docs/undocumented.json: -------------------------------------------------------------------------------- 1 | { 2 | "warnings": [ 3 | 4 | ], 5 | "source_directory": "/Users/jmattiello/Workspace/github/RxReachability/Sources" 6 | } --------------------------------------------------------------------------------