├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── .swift-version ├── .swiftformat ├── .swiftlint.yml ├── .swiftpm └── xcode │ └── xcshareddata │ └── xcschemes │ └── Connectivity.xcscheme ├── .travis.yml ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Connectivity.podspec ├── Connectivity ├── Assets │ └── .gitkeep └── Classes │ ├── .gitkeep │ ├── Combine │ ├── ConnectivityPublisher.swift │ └── ConnectivitySubscription.swift │ ├── Connectivity.swift │ ├── Extensions │ ├── NotificationNameAdditions.swift │ └── PublishersAdditions.swift │ ├── Model │ ├── ConnectivityConfiguration.swift │ ├── ConnectivityFramework.swift │ ├── ConnectivityInterface.swift │ ├── ConnectivityPercentage.swift │ └── ConnectivityStatus.swift │ ├── Reachability │ ├── LICENSE.txt │ ├── Reachability.h │ └── Reachability.m │ └── Response Validation │ ├── ConnectivityResponseValidationMode.swift │ ├── ConnectivityResponseValidator.swift │ ├── Factory │ ├── Factory.swift │ └── ResponseValidatorFactory.swift │ └── Validators │ ├── ConnectivityResponseContainsStringValidator.swift │ ├── ConnectivityResponseRegExValidator.swift │ ├── ConnectivityResponseStringEqualityValidator.swift │ └── ConnectivityResponseStringValidator.swift ├── ConnectivityLogo.png ├── Example ├── Connectivity.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ ├── Connectivity-Example.xcscheme │ │ └── Connectivity_Example_macOS.xcscheme ├── Connectivity.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Connectivity │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── CombineViewController.swift │ ├── Connectivity_Example-Bridging-Header.h │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── MenuViewController.swift │ ├── ObjCViewController.h │ ├── ObjCViewController.m │ ├── OriginalExampleViewController.swift │ └── UIColorAdditions.swift ├── Connectivity_Example_macOS │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Base.lproj │ │ └── Main.storyboard │ ├── Connectivity_Example_macOS.entitlements │ ├── Info.plist │ └── ViewController.swift ├── Podfile ├── Podfile.lock ├── Pods │ ├── Local Podspecs │ │ └── Connectivity.podspec.json │ ├── Manifest.lock │ ├── OHHTTPStubs │ │ ├── LICENSE │ │ ├── README.md │ │ └── Sources │ │ │ ├── OHHTTPStubs │ │ │ ├── HTTPStubs+NSURLSessionConfiguration.m │ │ │ ├── HTTPStubs.m │ │ │ ├── HTTPStubsMethodSwizzling.h │ │ │ ├── HTTPStubsMethodSwizzling.m │ │ │ ├── HTTPStubsPathHelpers.m │ │ │ ├── HTTPStubsResponse+JSON.m │ │ │ ├── HTTPStubsResponse.m │ │ │ ├── NSURLRequest+HTTPBodyTesting.m │ │ │ └── include │ │ │ │ ├── Compatibility.h │ │ │ │ ├── HTTPStubs.h │ │ │ │ ├── HTTPStubsPathHelpers.h │ │ │ │ ├── HTTPStubsResponse+JSON.h │ │ │ │ ├── HTTPStubsResponse.h │ │ │ │ └── NSURLRequest+HTTPBodyTesting.h │ │ │ └── OHHTTPStubsSwift │ │ │ └── OHHTTPStubsSwift.swift │ ├── Pods.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── Connectivity-iOS.xcscheme │ │ │ └── Connectivity-macOS.xcscheme │ └── Target Support Files │ │ ├── Connectivity-iOS │ │ ├── Connectivity-iOS-Info.plist │ │ ├── Connectivity-iOS-dummy.m │ │ ├── Connectivity-iOS-prefix.pch │ │ ├── Connectivity-iOS-umbrella.h │ │ ├── Connectivity-iOS.debug.xcconfig │ │ ├── Connectivity-iOS.modulemap │ │ ├── Connectivity-iOS.release.xcconfig │ │ ├── PrivacyInfo.xcprivacy │ │ └── ResourceBundle-Connectivity_Privacy-Connectivity-iOS-Info.plist │ │ ├── Connectivity-macOS │ │ ├── Connectivity-macOS-Info.plist │ │ ├── Connectivity-macOS-dummy.m │ │ ├── Connectivity-macOS-prefix.pch │ │ ├── Connectivity-macOS-umbrella.h │ │ ├── Connectivity-macOS.debug.xcconfig │ │ ├── Connectivity-macOS.modulemap │ │ ├── Connectivity-macOS.release.xcconfig │ │ └── ResourceBundle-Connectivity_Privacy-Connectivity-macOS-Info.plist │ │ ├── OHHTTPStubs │ │ ├── OHHTTPStubs-Info.plist │ │ ├── OHHTTPStubs-dummy.m │ │ ├── OHHTTPStubs-prefix.pch │ │ ├── OHHTTPStubs-umbrella.h │ │ ├── OHHTTPStubs.debug.xcconfig │ │ ├── OHHTTPStubs.modulemap │ │ └── OHHTTPStubs.release.xcconfig │ │ ├── Pods-Connectivity_Example │ │ ├── Pods-Connectivity_Example-Info.plist │ │ ├── Pods-Connectivity_Example-acknowledgements.markdown │ │ ├── Pods-Connectivity_Example-acknowledgements.plist │ │ ├── Pods-Connectivity_Example-dummy.m │ │ ├── Pods-Connectivity_Example-frameworks.sh │ │ ├── Pods-Connectivity_Example-umbrella.h │ │ ├── Pods-Connectivity_Example.debug.xcconfig │ │ ├── Pods-Connectivity_Example.modulemap │ │ └── Pods-Connectivity_Example.release.xcconfig │ │ ├── Pods-Connectivity_Example_macOS │ │ ├── Pods-Connectivity_Example_macOS-Info.plist │ │ ├── Pods-Connectivity_Example_macOS-acknowledgements.markdown │ │ ├── Pods-Connectivity_Example_macOS-acknowledgements.plist │ │ ├── Pods-Connectivity_Example_macOS-dummy.m │ │ ├── Pods-Connectivity_Example_macOS-frameworks.sh │ │ ├── Pods-Connectivity_Example_macOS-umbrella.h │ │ ├── Pods-Connectivity_Example_macOS.debug.xcconfig │ │ ├── Pods-Connectivity_Example_macOS.modulemap │ │ └── Pods-Connectivity_Example_macOS.release.xcconfig │ │ └── Pods-Connectivity_Tests │ │ ├── Pods-Connectivity_Tests-Info.plist │ │ ├── Pods-Connectivity_Tests-acknowledgements.markdown │ │ ├── Pods-Connectivity_Tests-acknowledgements.plist │ │ ├── Pods-Connectivity_Tests-dummy.m │ │ ├── Pods-Connectivity_Tests-frameworks.sh │ │ ├── Pods-Connectivity_Tests-umbrella.h │ │ ├── Pods-Connectivity_Tests.debug.xcconfig │ │ ├── Pods-Connectivity_Tests.modulemap │ │ └── Pods-Connectivity_Tests.release.xcconfig └── Tests │ ├── BackgroundingTests.swift │ ├── ConnectivityConfigurationTests.swift │ ├── ConnectivityPercentageTests.swift │ ├── ConnectivityStatusTests.swift │ ├── ConnectivityTests.swift │ ├── Info.plist │ ├── MockResponseValidator.swift │ ├── PollingTests.swift │ ├── RegularExpressionResponseValidatorTests.swift │ ├── ResponseValidatorFactoryTests.swift │ ├── StringEqualityResponseValidatorTests.swift │ ├── failure-response.html │ ├── string-contains-response.html │ ├── string-equality-response.html │ └── success-response.html ├── LICENSE ├── Package.swift ├── README.md ├── _Pods.xcodeproj ├── docs ├── images │ ├── add-package.png │ ├── connectivity-banner.png │ ├── connectivity-large-logo.png │ ├── connectivity-logo.png │ └── package-options.png └── presentations │ └── connectivity.pdf └── tools └── linting ├── Package.resolved └── Package.swift /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: rwbutler 7 | 8 | --- 9 | 10 | **Have read the known issues? ** 11 | [ ] Yes, I have read and am familiar with the list of [known issues](https://github.com/rwbutler/Connectivity#known-issues). 12 | 13 | **Have tested on a physical device? ** 14 | [ ] Yes, I have tested on physical iOS device and the reported issue is still present. 15 | 16 | **Does code retain the `Connectivity` object? ** 17 | [ ] Yes, my implementation has a strong reference to the `Connectivity` object so that it is not deallocated during use. 18 | 19 | **Describe the bug** 20 | A clear and concise description of what the bug is. 21 | 22 | **To Reproduce** 23 | Steps to reproduce the behavior: 24 | 1. Go to '...' 25 | 2. Click on '....' 26 | 3. Scroll down to '....' 27 | 4. See error 28 | 29 | **Expected behavior** 30 | A clear and concise description of what you expected to happen. 31 | 32 | **Screenshots** 33 | If applicable, add screenshots to help explain your problem. 34 | 35 | **Desktop (please complete the following information):** 36 | - OS: [e.g. iOS] 37 | - Browser [e.g. chrome, safari] 38 | - Version [e.g. 22] 39 | 40 | **Smartphone (please complete the following information):** 41 | - Device: [e.g. iPhone6] 42 | - OS: [e.g. iOS8.1] 43 | - Browser [e.g. stock browser, safari] 44 | - Version [e.g. 22] 45 | 46 | **Additional context** 47 | Add any other context about the problem here. 48 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.afdesign 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata/ 13 | *.xccheckout 14 | profile 15 | *.moved-aside 16 | DerivedData 17 | *.hmap 18 | *.ipa 19 | *.key 20 | .bundle 21 | Carthage 22 | **/.build/** 23 | ObjCExample 24 | *.icloud -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 5.0 -------------------------------------------------------------------------------- /.swiftformat: -------------------------------------------------------------------------------- 1 | --allman false 2 | --binarygrouping none 3 | --closingparen balanced 4 | --commas always 5 | --conflictmarkers reject 6 | --decimalgrouping none 7 | --disable redundantReturn 8 | --elseposition same-line 9 | --empty void 10 | --exclude Example/Pods 11 | --exclude Package.swift 12 | --exclude ObjCExample 13 | --exponentcase lowercase 14 | --exponentgrouping disabled 15 | --fractiongrouping disabled 16 | --fragment false 17 | --header ignore 18 | --hexgrouping none 19 | --hexliteralcase uppercase 20 | --ifdef outdent 21 | --importgrouping alphabetized 22 | --indent 4 23 | --indentcase false 24 | --linebreaks lf 25 | --maxwidth none 26 | --octalgrouping none 27 | --operatorfunc spaced 28 | --patternlet hoist 29 | --ranges spaced 30 | --self init-only 31 | --selfrequired 32 | --semicolons never 33 | --stripunusedargs always 34 | --tabwidth unspecified 35 | --trailingclosures 36 | --trimwhitespace always 37 | --wraparguments before-first 38 | --wrapcollections preserve 39 | --xcodeindentation disabled 40 | -------------------------------------------------------------------------------- /.swiftlint.yml: -------------------------------------------------------------------------------- 1 | disabled_rules: 2 | - trailing_whitespace 3 | - file_length 4 | opt_in_rules: 5 | - empty_count 6 | included: 7 | - Connectivity/ 8 | reporter: "xcode" 9 | type_name: 10 | excluded: 11 | - T 12 | max_length: 13 | warning: 45 14 | error: 50 15 | -------------------------------------------------------------------------------- /.swiftpm/xcode/xcshareddata/xcschemes/Connectivity.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 46 | 47 | 57 | 58 | 64 | 65 | 71 | 72 | 73 | 74 | 76 | 77 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | osx_image: xcode12 3 | before_install: 4 | - gem install cocoapods -v '1.8.3' 5 | - brew update 6 | install: 7 | - brew install swiftformat 8 | - brew install swiftlint 9 | script: 10 | - gem install travis 11 | - travis lint .travis.yml --no-interactive 12 | - swiftformat . 13 | - swiftlint 14 | - xcodebuild clean build test -workspace Example/Connectivity.xcworkspace -scheme Connectivity-Example -destination "platform=iOS Simulator,name=iPhone 11 Pro" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO | xcpretty 15 | - pod lib lint 16 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at github@rwbutler.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Connectivity.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'Connectivity' 3 | s.version = '8.0.1' 4 | s.swift_version = '5.0' 5 | s.summary = 'Makes Internet connectivity detection more robust by detecting Wi-Fi networks without Internet access.' 6 | s.description = <<-DESC 7 | Connectivity wraps Apple's Reachability code to provide a reliable measure of whether Internet connectivity is available where Reachability alone can only indicate whether _an interface is available that might allow a connection_. Connectivity's objective is to solve the captive portal problem whereby an iOS device is connected to a Wi-Fi network lacking Internet connectivity. Such situations are commonplace and may occur for example when connecting to a public Wi-Fi network which requires the user to register before use. Connectivity can detect such situations enabling you to react accordingly. 8 | DESC 9 | 10 | s.homepage = 'https://github.com/rwbutler/Connectivity' 11 | s.license = { :type => 'MIT', :file => 'LICENSE' } 12 | s.author = { 'Ross Butler' => 'github@rwbutler.com' } 13 | s.source = { :git => 'https://github.com/rwbutler/Connectivity.git', :tag => s.version.to_s } 14 | s.ios.deployment_target = '12.0' 15 | s.tvos.deployment_target = '12.0' 16 | s.macos.deployment_target = '10.13' 17 | s.frameworks = 'SystemConfiguration' 18 | s.weak_frameworks = 'Network', 'Combine' 19 | s.source_files = 'Connectivity/Classes/**/*' 20 | s.exclude_files = [ 21 | 'Connectivity/Classes/Reachability/LICENSE.txt' 22 | ] 23 | end 24 | -------------------------------------------------------------------------------- /Connectivity/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rwbutler/Connectivity/30956aa751170afee0feb340714829dff159b265/Connectivity/Assets/.gitkeep -------------------------------------------------------------------------------- /Connectivity/Classes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rwbutler/Connectivity/30956aa751170afee0feb340714829dff159b265/Connectivity/Classes/.gitkeep -------------------------------------------------------------------------------- /Connectivity/Classes/Combine/ConnectivityPublisher.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectivityPublisher.swift 3 | // Connectivity 4 | // 5 | // Created by Ross Butler on 05/05/2020. 6 | // 7 | 8 | #if canImport(Combine) 9 | 10 | import Combine 11 | import Foundation 12 | 13 | @available(OSX 10.15, iOS 13.0, tvOS 13.0, *) 14 | public struct ConnectivityPublisher: Publisher { 15 | public typealias Output = Connectivity 16 | public typealias Failure = Never 17 | private let configuration: ConnectivityConfiguration 18 | 19 | public init(configuration: ConnectivityConfiguration = ConnectivityConfiguration()) { 20 | self.configuration = configuration 21 | } 22 | 23 | public func receive(subscriber: S) 24 | where ConnectivityPublisher.Failure == S.Failure, ConnectivityPublisher.Output == S.Input { 25 | let subscription = ConnectivitySubscription(configuration: configuration, subscriber: subscriber) 26 | subscriber.receive(subscription: subscription) 27 | } 28 | } 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /Connectivity/Classes/Combine/ConnectivitySubscription.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectivitySubscription.swift 3 | // Connectivity 4 | // 5 | // Created by Ross Butler on 05/05/2020. 6 | // 7 | 8 | #if canImport(Combine) 9 | 10 | import Combine 11 | import Foundation 12 | 13 | @available(OSX 10.15, iOS 13.0, tvOS 13.0, *) 14 | class ConnectivitySubscription: Subscription where S.Input == Connectivity, S.Failure == Never { 15 | private let connectivity: Connectivity 16 | private var subscriber: S? 17 | 18 | init(configuration: ConnectivityConfiguration, subscriber: S) { 19 | connectivity = Connectivity(configuration: configuration) 20 | self.subscriber = subscriber 21 | startNotifier(with: subscriber) 22 | } 23 | 24 | func cancel() { 25 | stopNotifier() 26 | } 27 | 28 | func request(_: Subscribers.Demand) {} 29 | 30 | private func startNotifier(with subscriber: S) { 31 | let connectivityChanged: (Connectivity) -> Void = { connectivity in 32 | _ = subscriber.receive(connectivity) 33 | } 34 | connectivity.whenConnected = connectivityChanged 35 | connectivity.whenDisconnected = connectivityChanged 36 | connectivity.startNotifier() 37 | } 38 | 39 | private func stopNotifier() { 40 | connectivity.stopNotifier() 41 | subscriber = nil 42 | } 43 | } 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /Connectivity/Classes/Extensions/NotificationNameAdditions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NotificationNameAdditions.swift 3 | // Connectivity 4 | // 5 | // Created by Ross Butler on 12/9/18. 6 | // 7 | 8 | import Foundation 9 | 10 | public extension Notification.Name { 11 | static let ReachabilityDidChange = Notification.Name("kNetworkReachabilityChangedNotification") 12 | static let ConnectivityDidChange = Notification.Name("kNetworkConnectivityChangedNotification") 13 | } 14 | -------------------------------------------------------------------------------- /Connectivity/Classes/Extensions/PublishersAdditions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Publishers.swift 3 | // Connectivity 4 | // 5 | // Created by Ross Butler on 05/05/2020. 6 | // 7 | 8 | #if canImport(Combine) 9 | 10 | import Combine 11 | import Foundation 12 | 13 | @available(OSX 10.15, iOS 13.0, tvOS 13.0, *) 14 | public extension Publishers { 15 | typealias Connectivity = ConnectivityPublisher 16 | } 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /Connectivity/Classes/Model/ConnectivityConfiguration.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectivityConfiguration.swift 3 | // Connectivity 4 | // 5 | // Created by Ross Butler on 14/05/2022. 6 | // 7 | 8 | import Foundation 9 | 10 | typealias Configuration = ConnectivityConfiguration // For internal use. 11 | 12 | @objc public class ConnectivityConfiguration: NSObject { 13 | private(set) var authorizationHeader: String? 14 | private(set) var bearerToken: String? 15 | let callbackQueue: DispatchQueue 16 | private(set) var checkWhenApplicationDidBecomeActive: Bool = true 17 | let connectivityQueue: DispatchQueue 18 | private(set) var connectivityURLRequests: [URLRequest] 19 | public static let defaultConnectivityURLRequests = [ 20 | URL(string: "https://www.apple.com/library/test/success.html"), 21 | URL(string: "https://captive.apple.com/hotspot-detect.html") 22 | ] 23 | .compactMap { 24 | $0 25 | } 26 | .map { 27 | URLRequest(url: $0) 28 | } 29 | public static let defaultURLSessionConfiguration: URLSessionConfiguration = { 30 | let sessionConfiguration = URLSessionConfiguration.default 31 | sessionConfiguration.requestCachePolicy = .reloadIgnoringCacheData 32 | sessionConfiguration.urlCache = nil 33 | sessionConfiguration.timeoutIntervalForRequest = 5.0 34 | sessionConfiguration.timeoutIntervalForResource = 5.0 35 | return sessionConfiguration 36 | }() 37 | private(set) var framework: Connectivity.Framework = .network 38 | private(set) var pollingInterval: Double 39 | private(set) var pollingIsEnabled: Bool 40 | private(set) var pollWhileOfflineOnly: Bool 41 | private(set) var responseValidator: ResponseValidator 42 | 43 | /// % successful connections required to be deemed to have connectivity 44 | let successThreshold: Connectivity.Percentage 45 | private(set) var urlSessionConfiguration: URLSessionConfiguration 46 | private(set) var validationMode: Connectivity.ValidationMode? 47 | 48 | public init( 49 | callbackQueue: DispatchQueue = DispatchQueue.main, 50 | checkWhenApplicationDidBecomeActive: Bool = true, 51 | connectivityQueue: DispatchQueue = .global(qos: .default), 52 | connectivityURLRequests: [URLRequest] = defaultConnectivityURLRequests, 53 | pollingInterval: Double = 10.0, 54 | pollingIsEnabled: Bool = true, 55 | pollWhileOfflineOnly: Bool = true, 56 | responseValidator: ConnectivityResponseValidator = ConnectivityResponseStringValidator( 57 | validationMode: .containsExpectedResponseString, 58 | expectedResponse: "Success" 59 | ), 60 | successThreshold: Connectivity.Percentage = Connectivity.Percentage(50.0), 61 | urlSessionConfiguration: URLSessionConfiguration = defaultURLSessionConfiguration, 62 | validationMode: Connectivity.ValidationMode? = nil 63 | ) { 64 | self.callbackQueue = callbackQueue 65 | self.checkWhenApplicationDidBecomeActive = checkWhenApplicationDidBecomeActive 66 | self.connectivityQueue = connectivityQueue 67 | self.connectivityURLRequests = connectivityURLRequests 68 | self.pollingInterval = pollingInterval 69 | self.pollingIsEnabled = pollingIsEnabled 70 | self.pollWhileOfflineOnly = pollWhileOfflineOnly 71 | self.responseValidator = responseValidator 72 | self.successThreshold = successThreshold 73 | self.urlSessionConfiguration = urlSessionConfiguration 74 | self.validationMode = validationMode 75 | } 76 | 77 | // MARK: Fluent configuration API. 78 | 79 | public func configureAuthorizationHeader(with value: String?) -> Self { 80 | self.authorizationHeader = value 81 | return self 82 | } 83 | 84 | public func configureBearerToken(with token: String?) -> Self { 85 | self.bearerToken = token 86 | return self 87 | } 88 | 89 | public func configureConnectivity(urls: [URL]) -> Self { 90 | self.connectivityURLRequests = urls.map { 91 | URLRequest(url: $0) 92 | } 93 | return self 94 | } 95 | 96 | public func configureConnectivity(urlRequests: [URLRequest]) -> Self { 97 | self.connectivityURLRequests = urlRequests 98 | return self 99 | } 100 | 101 | public func configureFramework(_ framework: Connectivity.Framework) -> Self { 102 | self.framework = framework 103 | return self 104 | } 105 | 106 | public func configurePolling(isEnabled: Bool = true, interval: Double = 10.0, offlineOnly: Bool = true) -> Self { 107 | pollingIsEnabled = isEnabled 108 | pollingInterval = interval 109 | pollWhileOfflineOnly = offlineOnly 110 | return self 111 | } 112 | 113 | public func configureResponseValidation( 114 | _ validation: ConnectivityResponseStringValidator.ValidationMode, 115 | expected: String 116 | ) -> Self { 117 | responseValidator = ResponseStringValidator(validationMode: validation, expectedResponse: expected) 118 | return self 119 | } 120 | 121 | public func configureResponseValidator(_ responseValidator: ConnectivityResponseValidator) -> Self { 122 | self.responseValidator = responseValidator 123 | return self 124 | } 125 | 126 | public func configureShouldCheckWhenApplicationDidBecomeActive(_ enabled: Bool) { 127 | checkWhenApplicationDidBecomeActive = enabled 128 | } 129 | 130 | public func configureURLSession(_ urlSessionConfiguration: URLSessionConfiguration) -> Self { 131 | self.urlSessionConfiguration = urlSessionConfiguration 132 | return self 133 | } 134 | 135 | public func configureValidationMode(with validationMode: Connectivity.ValidationMode) -> Self { 136 | self.validationMode = validationMode 137 | return self 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /Connectivity/Classes/Model/ConnectivityFramework.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectivityFramework.swift 3 | // Connectivity 4 | // 5 | // Created by Ross Butler on 12/9/18. 6 | // 7 | 8 | import Foundation 9 | 10 | @objc public enum ConnectivityFramework: Int { 11 | case network 12 | case systemConfiguration 13 | } 14 | -------------------------------------------------------------------------------- /Connectivity/Classes/Model/ConnectivityInterface.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectivityInterface.swift 3 | // Connectivity 4 | // 5 | // Created by Ross Butler on 8/8/19. 6 | // 7 | 8 | import Foundation 9 | import Network 10 | 11 | public enum ConnectivityInterface { 12 | case cellular 13 | case ethernet 14 | case loopback 15 | case other 16 | case wifi 17 | } 18 | -------------------------------------------------------------------------------- /Connectivity/Classes/Model/ConnectivityPercentage.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectivityPercentage.swift 3 | // Connectivity 4 | // 5 | // Created by Ross Butler on 12/9/18. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct ConnectivityPercentage: Comparable { 11 | let value: Double 12 | 13 | public init(_ value: Double) { 14 | var result = value < 0.0 ? 0.0 : value 15 | result = result > 100.0 ? 100.0 : result 16 | self.value = result 17 | } 18 | 19 | public init(_ value: UInt, outOf total: UInt) { 20 | self.init(Double(value), outOf: Double(total)) 21 | } 22 | 23 | public init(_ value: Double, outOf total: Double) { 24 | guard total > 0 else { 25 | self.init(0.0) 26 | return 27 | } 28 | self.init((value / total) * 100.0) 29 | } 30 | 31 | public static func < (lhs: Self, rhs: Self) -> Bool { 32 | return lhs.value < rhs.value 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Connectivity/Classes/Model/ConnectivityStatus.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectivityStatus.swift 3 | // Connectivity 4 | // 5 | // Created by Ross Butler on 12/9/18. 6 | // 7 | 8 | import Foundation 9 | 10 | @objc public enum ConnectivityStatus: Int, CustomStringConvertible { 11 | case connected, // where a connection is present but the interface cannot be determined. 12 | connectedViaCellular, 13 | connectedViaCellularWithoutInternet, 14 | connectedViaEthernet, 15 | connectedViaEthernetWithoutInternet, 16 | connectedViaWiFi, 17 | connectedViaWiFiWithoutInternet, 18 | determining, 19 | notConnected 20 | 21 | public var description: String { 22 | switch self { 23 | case .connected: 24 | return "Internet access" 25 | case .connectedViaCellular: 26 | return "Cellular with Internet access" 27 | case .connectedViaCellularWithoutInternet: 28 | return "Cellular without Internet access" 29 | case .connectedViaEthernet: 30 | return "Ethernet with Internet access" 31 | case .connectedViaEthernetWithoutInternet: 32 | return "Ethernet without Internet access" 33 | case .connectedViaWiFi: 34 | return "Wi-Fi with Internet access" 35 | case .connectedViaWiFiWithoutInternet: 36 | return "Wi-Fi without Internet access" 37 | case .determining: 38 | return "Connectivity checks pending" 39 | case .notConnected: 40 | return "No Connection" 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Connectivity/Classes/Reachability/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Sample code project: Reachability 2 | Version: 5.0 3 | 4 | IMPORTANT: This Apple software is supplied to you by Apple 5 | Inc. ("Apple") in consideration of your agreement to the following 6 | terms, and your use, installation, modification or redistribution of 7 | this Apple software constitutes acceptance of these terms. If you do 8 | not agree with these terms, please do not use, install, modify or 9 | redistribute this Apple software. 10 | 11 | In consideration of your agreement to abide by the following terms, and 12 | subject to these terms, Apple grants you a personal, non-exclusive 13 | license, under Apple's copyrights in this original Apple software (the 14 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 15 | Software, with or without modifications, in source and/or binary forms; 16 | provided that if you redistribute the Apple Software in its entirety and 17 | without modifications, you must retain this notice and the following 18 | text and disclaimers in all such redistributions of the Apple Software. 19 | Neither the name, trademarks, service marks or logos of Apple Inc. may 20 | be used to endorse or promote products derived from the Apple Software 21 | without specific prior written permission from Apple. Except as 22 | expressly stated in this notice, no other rights or licenses, express or 23 | implied, are granted by Apple herein, including but not limited to any 24 | patent rights that may be infringed by your derivative works or by other 25 | works in which the Apple Software may be incorporated. 26 | 27 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 28 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 29 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 30 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 31 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 32 | 33 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 34 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 35 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 36 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 37 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 38 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 39 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 40 | POSSIBILITY OF SUCH DAMAGE. 41 | 42 | Copyright (C) 2016 Apple Inc. All Rights Reserved. 43 | -------------------------------------------------------------------------------- /Connectivity/Classes/Reachability/Reachability.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2016 Apple Inc. All Rights Reserved. 3 | See LICENSE.txt for this sample’s licensing information 4 | 5 | Abstract: 6 | Basic demonstration of how to use the SystemConfiguration Reachablity APIs. 7 | */ 8 | 9 | #import 10 | 11 | typedef enum : NSInteger { 12 | NotReachable = 0, 13 | ReachableViaWiFi, 14 | ReachableViaWWAN 15 | } NetworkStatus; 16 | 17 | #pragma mark IPv6 Support 18 | //Reachability fully support IPv6. For full details, see ReadMe.md. 19 | 20 | 21 | extern NSString *kReachabilityChangedNotification; 22 | 23 | 24 | @interface Reachability : NSObject 25 | 26 | /*! 27 | * Use to check the reachability of a given host name. 28 | */ 29 | + (instancetype)reachabilityWithHostName:(NSString *)hostName; 30 | 31 | /*! 32 | * Use to check the reachability of a given IP address. 33 | */ 34 | + (instancetype)reachabilityWithAddress:(const struct sockaddr *)hostAddress; 35 | 36 | /*! 37 | * Checks whether the default route is available. Should be used by applications that do not connect to a particular host. 38 | */ 39 | + (instancetype)reachabilityForInternetConnection; 40 | 41 | 42 | #pragma mark reachabilityForLocalWiFi 43 | //reachabilityForLocalWiFi has been removed from the sample. See ReadMe.md for more information. 44 | //+ (instancetype)reachabilityForLocalWiFi; 45 | 46 | /*! 47 | * Start listening for reachability notifications on the current run loop. 48 | */ 49 | - (BOOL)startNotifier; 50 | - (void)stopNotifier; 51 | 52 | - (NetworkStatus)currentReachabilityStatus; 53 | 54 | /*! 55 | * WWAN may be available, but not active until a connection has been established. WiFi may require a connection for VPN on Demand. 56 | */ 57 | - (BOOL)connectionRequired; 58 | 59 | @end 60 | 61 | 62 | -------------------------------------------------------------------------------- /Connectivity/Classes/Reachability/Reachability.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2016 Apple Inc. All Rights Reserved. 3 | See LICENSE.txt for this sample’s licensing information 4 | 5 | Abstract: 6 | Basic demonstration of how to use the SystemConfiguration Reachablity APIs. 7 | */ 8 | 9 | #import 10 | #import 11 | #import 12 | #import 13 | #import 14 | #import 15 | #import "Reachability.h" 16 | 17 | #pragma mark IPv6 Support 18 | //Reachability fully support IPv6. For full details, see ReadMe.md. 19 | 20 | 21 | NSString *kReachabilityChangedNotification = @"kNetworkReachabilityChangedNotification"; 22 | 23 | 24 | #pragma mark - Supporting functions 25 | 26 | #define kShouldPrintReachabilityFlags 1 27 | 28 | static void PrintReachabilityFlags(SCNetworkReachabilityFlags flags, const char* comment) 29 | { 30 | #if kShouldPrintReachabilityFlags 31 | 32 | NSLog(@"Reachability Flag Status: %c%c %c%c%c%c%c%c%c %s\n", 33 | #if !TARGET_OS_OSX 34 | (flags & kSCNetworkReachabilityFlagsIsWWAN) ? 'W' : '-', 35 | #else 36 | 'X', 37 | #endif 38 | (flags & kSCNetworkReachabilityFlagsReachable) ? 'R' : '-', 39 | 40 | (flags & kSCNetworkReachabilityFlagsTransientConnection) ? 't' : '-', 41 | (flags & kSCNetworkReachabilityFlagsConnectionRequired) ? 'c' : '-', 42 | (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) ? 'C' : '-', 43 | (flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-', 44 | (flags & kSCNetworkReachabilityFlagsConnectionOnDemand) ? 'D' : '-', 45 | (flags & kSCNetworkReachabilityFlagsIsLocalAddress) ? 'l' : '-', 46 | (flags & kSCNetworkReachabilityFlagsIsDirect) ? 'd' : '-', 47 | comment 48 | ); 49 | #endif 50 | } 51 | 52 | 53 | static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info) 54 | { 55 | #pragma unused (target, flags) 56 | NSCAssert(info != NULL, @"info was NULL in ReachabilityCallback"); 57 | NSCAssert([(__bridge NSObject*) info isKindOfClass: [Reachability class]], @"info was wrong class in ReachabilityCallback"); 58 | 59 | Reachability* noteObject = (__bridge Reachability *)info; 60 | // Post a notification to notify the client that the network reachability changed. 61 | [[NSNotificationCenter defaultCenter] postNotificationName: kReachabilityChangedNotification object: noteObject]; 62 | } 63 | 64 | 65 | #pragma mark - Reachability implementation 66 | 67 | @implementation Reachability 68 | { 69 | SCNetworkReachabilityRef _reachabilityRef; 70 | } 71 | 72 | + (instancetype)reachabilityWithHostName:(NSString *)hostName 73 | { 74 | Reachability* returnValue = NULL; 75 | SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, [hostName UTF8String]); 76 | if (reachability != NULL) 77 | { 78 | returnValue= [[self alloc] init]; 79 | if (returnValue != NULL) 80 | { 81 | returnValue->_reachabilityRef = reachability; 82 | } 83 | else { 84 | CFRelease(reachability); 85 | } 86 | } 87 | return returnValue; 88 | } 89 | 90 | 91 | + (instancetype)reachabilityWithAddress:(const struct sockaddr *)hostAddress 92 | { 93 | SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, hostAddress); 94 | 95 | Reachability* returnValue = NULL; 96 | 97 | if (reachability != NULL) 98 | { 99 | returnValue = [[self alloc] init]; 100 | if (returnValue != NULL) 101 | { 102 | returnValue->_reachabilityRef = reachability; 103 | } 104 | else { 105 | CFRelease(reachability); 106 | } 107 | } 108 | return returnValue; 109 | } 110 | 111 | 112 | + (instancetype)reachabilityForInternetConnection 113 | { 114 | struct sockaddr_in zeroAddress; 115 | bzero(&zeroAddress, sizeof(zeroAddress)); 116 | zeroAddress.sin_len = sizeof(zeroAddress); 117 | zeroAddress.sin_family = AF_INET; 118 | 119 | return [self reachabilityWithAddress: (const struct sockaddr *) &zeroAddress]; 120 | } 121 | 122 | #pragma mark reachabilityForLocalWiFi 123 | //reachabilityForLocalWiFi has been removed from the sample. See ReadMe.md for more information. 124 | //+ (instancetype)reachabilityForLocalWiFi 125 | 126 | 127 | 128 | #pragma mark - Start and stop notifier 129 | 130 | - (BOOL)startNotifier 131 | { 132 | BOOL returnValue = NO; 133 | SCNetworkReachabilityContext context = {0, (__bridge void *)(self), NULL, NULL, NULL}; 134 | 135 | if (SCNetworkReachabilitySetCallback(_reachabilityRef, ReachabilityCallback, &context)) 136 | { 137 | if (SCNetworkReachabilityScheduleWithRunLoop(_reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode)) 138 | { 139 | returnValue = YES; 140 | } 141 | } 142 | 143 | return returnValue; 144 | } 145 | 146 | 147 | - (void)stopNotifier 148 | { 149 | if (_reachabilityRef != NULL) 150 | { 151 | SCNetworkReachabilityUnscheduleFromRunLoop(_reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); 152 | } 153 | } 154 | 155 | 156 | - (void)dealloc 157 | { 158 | [self stopNotifier]; 159 | if (_reachabilityRef != NULL) 160 | { 161 | CFRelease(_reachabilityRef); 162 | } 163 | } 164 | 165 | 166 | #pragma mark - Network Flag Handling 167 | 168 | - (NetworkStatus)networkStatusForFlags:(SCNetworkReachabilityFlags)flags 169 | { 170 | PrintReachabilityFlags(flags, "networkStatusForFlags"); 171 | if ((flags & kSCNetworkReachabilityFlagsReachable) == 0) 172 | { 173 | // The target host is not reachable. 174 | return NotReachable; 175 | } 176 | 177 | NetworkStatus returnValue = NotReachable; 178 | 179 | if ((flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0) 180 | { 181 | /* 182 | If the target host is reachable and no connection is required then we'll assume (for now) that you're on Wi-Fi... 183 | */ 184 | returnValue = ReachableViaWiFi; 185 | } 186 | 187 | if ((((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) || 188 | (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0)) 189 | { 190 | /* 191 | ... and the connection is on-demand (or on-traffic) if the calling application is using the CFSocketStream or higher APIs... 192 | */ 193 | 194 | if ((flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0) 195 | { 196 | /* 197 | ... and no [user] intervention is needed... 198 | */ 199 | returnValue = ReachableViaWiFi; 200 | } 201 | } 202 | 203 | #if !TARGET_OS_OSX 204 | if ((flags & kSCNetworkReachabilityFlagsIsWWAN) == kSCNetworkReachabilityFlagsIsWWAN) 205 | { 206 | /* 207 | ... but WWAN connections are OK if the calling application is using the CFNetwork APIs. 208 | */ 209 | returnValue = ReachableViaWWAN; 210 | } 211 | #endif 212 | 213 | return returnValue; 214 | } 215 | 216 | 217 | - (BOOL)connectionRequired 218 | { 219 | NSAssert(_reachabilityRef != NULL, @"connectionRequired called with NULL reachabilityRef"); 220 | SCNetworkReachabilityFlags flags; 221 | 222 | if (SCNetworkReachabilityGetFlags(_reachabilityRef, &flags)) 223 | { 224 | return (flags & kSCNetworkReachabilityFlagsConnectionRequired); 225 | } 226 | 227 | return NO; 228 | } 229 | 230 | 231 | - (NetworkStatus)currentReachabilityStatus 232 | { 233 | NSAssert(_reachabilityRef != NULL, @"currentNetworkStatus called with NULL SCNetworkReachabilityRef"); 234 | NetworkStatus returnValue = NotReachable; 235 | SCNetworkReachabilityFlags flags; 236 | 237 | if (SCNetworkReachabilityGetFlags(_reachabilityRef, &flags)) 238 | { 239 | returnValue = [self networkStatusForFlags:flags]; 240 | } 241 | 242 | return returnValue; 243 | } 244 | 245 | 246 | @end 247 | -------------------------------------------------------------------------------- /Connectivity/Classes/Response Validation/ConnectivityResponseValidationMode.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectivityResponseValidationMode.swift 3 | // Connectivity 4 | // 5 | // Created by Ross Butler on 1/20/19. 6 | // 7 | 8 | import Foundation 9 | 10 | @objc 11 | public enum ConnectivityResponseValidationMode: Int { 12 | case containsExpectedResponseString, 13 | equalsExpectedResponseString, 14 | matchesRegularExpression, 15 | custom 16 | } 17 | -------------------------------------------------------------------------------- /Connectivity/Classes/Response Validation/ConnectivityResponseValidator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectivityResponseValidator.swift 3 | // Connectivity 4 | // 5 | // Created by Benjamin Asher on 10/12/19. 6 | // 7 | 8 | import Foundation 9 | 10 | typealias ResponseValidator = ConnectivityResponseValidator // For internal use. 11 | 12 | /// The contract for a response validator used to determine 13 | /// connectivity based on a network response 14 | @objc public protocol ConnectivityResponseValidator { 15 | /// Determines whether or not the response is valid 16 | /// and expected for a given `URL` 17 | /// 18 | /// - Parameter url: The `URLRequest`, from which the response was fetched. 19 | /// - Parameter response: The `URLResponse` returned by url. 20 | /// - Parameter data: The data in the response returned by url. 21 | func isResponseValid(urlRequest: URLRequest, response: URLResponse?, data: Data?) -> Bool 22 | } 23 | -------------------------------------------------------------------------------- /Connectivity/Classes/Response Validation/Factory/Factory.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Factory.swift 3 | // Connectivity 4 | // 5 | // Created by Ross Butler on 25/10/2019. 6 | // 7 | 8 | import Foundation 9 | 10 | protocol Factory { 11 | associatedtype T 12 | func manufacture() -> T 13 | } 14 | -------------------------------------------------------------------------------- /Connectivity/Classes/Response Validation/Factory/ResponseValidatorFactory.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ResponseValidatorFactory.swift 3 | // Connectivity 4 | // 5 | // Created by Ross Butler on 25/10/2019. 6 | // 7 | 8 | import Foundation 9 | 10 | struct ResponseValidatorFactory: Factory { 11 | typealias ValidationMode = ConnectivityResponseValidationMode 12 | typealias Validator = ConnectivityResponseValidator 13 | 14 | /// A custom validator if the user has supplied one 15 | private let customValidator: Validator 16 | 17 | /// String used to match against the response to determine whether or not it is valid. 18 | private let expectedResponse: String 19 | 20 | /// Regular expression used to determine whether or not the response is valid. 21 | private let regularExpression: String 22 | 23 | /// Determines the means of validating the response. 24 | private let validationMode: ValidationMode 25 | 26 | init( 27 | validationMode: ValidationMode, 28 | expectedResponse: String, 29 | regEx: String, 30 | customValidator: Validator 31 | ) { 32 | self.customValidator = customValidator 33 | self.expectedResponse = expectedResponse 34 | self.regularExpression = regEx 35 | self.validationMode = validationMode 36 | } 37 | 38 | /// Returns the appropriate validator for the given validation mode. 39 | func manufacture() -> Validator { 40 | let validator: Validator 41 | switch validationMode { 42 | case .equalsExpectedResponseString: 43 | validator = ConnectivityResponseStringEqualityValidator( 44 | expectedResponse: expectedResponse 45 | ) 46 | case .containsExpectedResponseString: 47 | validator = ConnectivityResponseContainsStringValidator( 48 | expectedResponse: expectedResponse 49 | ) 50 | case .matchesRegularExpression: 51 | validator = ConnectivityResponseRegExValidator( 52 | regEx: regularExpression 53 | ) 54 | case .custom: 55 | validator = customValidator 56 | } 57 | return validator 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Connectivity/Classes/Response Validation/Validators/ConnectivityResponseContainsStringValidator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectivityResponseContainsStringValidator.swift 3 | // Connectivity 4 | // 5 | // Created by Ross Butler on 26/10/2019. 6 | // 7 | 8 | import Foundation 9 | 10 | typealias ResponseContainsStringValidator = ConnectivityResponseContainsStringValidator // For internal use. 11 | 12 | @objcMembers 13 | public class ConnectivityResponseContainsStringValidator: ConnectivityResponseValidator { 14 | /// The `String` expected to be contained in the response 15 | public let expectedResponse: String 16 | 17 | /// Initializes the receiver to validate that the response `String` contains the expected response. 18 | /// 19 | /// - Parameter expectedResponse: The `String` expected to be contained in the response. 20 | public init(expectedResponse: String = "Success") { 21 | self.expectedResponse = expectedResponse 22 | } 23 | 24 | public func isResponseValid(urlRequest _: URLRequest, response _: URLResponse?, data: Data?) -> Bool { 25 | guard let data = data, let responseString = String(data: data, encoding: .utf8) else { 26 | return false 27 | } 28 | return responseString.contains(expectedResponse) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Connectivity/Classes/Response Validation/Validators/ConnectivityResponseRegExValidator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectivityResponseRegExValidator.swift 3 | // Connectivity 4 | // 5 | // Created by Ross Butler on 23/10/2019. 6 | // 7 | 8 | import Foundation 9 | 10 | typealias ResponseRegExValidator = ConnectivityResponseRegExValidator // For internal use. 11 | 12 | @objcMembers 13 | public class ConnectivityResponseRegExValidator: ConnectivityResponseValidator { 14 | public static let defaultRegularExpression = ".*?.*?Success.*?.*" 15 | 16 | /// Matching options for determining how the response is matched against the regular expression. 17 | private let options: NSRegularExpression.Options 18 | 19 | /// Response `String` is matched against the regex to determine whether or not the response is valid. 20 | private let regularExpression: String 21 | 22 | /// Initializes the receiver to validate the response against a supplied regular expression. 23 | /// - Parameters: 24 | /// - options: Matching options for determining whether or not the response `String` 25 | /// matching the provided regular expression. 26 | /// - regEx: Regular expression used to validate the response. If the response 27 | /// `String` matches the regular expression then the response is deemed to be valid. 28 | public init( 29 | regEx: String = ConnectivityResponseRegExValidator.defaultRegularExpression, 30 | options: NSRegularExpression.Options? = nil 31 | ) { 32 | self.options = options ?? [.caseInsensitive, .allowCommentsAndWhitespace, .dotMatchesLineSeparators] 33 | self.regularExpression = regEx 34 | } 35 | 36 | public func isResponseValid(urlRequest _: URLRequest, response _: URLResponse?, data: Data?) -> Bool { 37 | guard let data = data, let responseString = String(data: data, encoding: .utf8), 38 | let regEx = try? NSRegularExpression(pattern: regularExpression, options: options) 39 | else { 40 | return false 41 | } 42 | let responseStrRange = NSRange(location: 0, length: responseString.count) 43 | let matches = regEx.matches(in: responseString, options: [], range: responseStrRange) 44 | return !matches.isEmpty 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Connectivity/Classes/Response Validation/Validators/ConnectivityResponseStringEqualityValidator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectivityResponseStringEqualityValidator.swift 3 | // Connectivity 4 | // 5 | // Created by Ross Butler on 25/10/2019. 6 | // 7 | 8 | import Foundation 9 | 10 | typealias ResponseStringEqualityValidator = ConnectivityResponseStringEqualityValidator // For internal use. 11 | 12 | @objcMembers 13 | public class ConnectivityResponseStringEqualityValidator: ConnectivityResponseValidator { 14 | /// The `String` expected as the response 15 | public let expectedResponse: String 16 | 17 | /// Initializes the receiver to validate that the response `String` is equal to the expected response. 18 | /// 19 | /// - Parameter expectedResponse: The `String` expected as the response. 20 | public init(expectedResponse: String) { 21 | self.expectedResponse = expectedResponse 22 | } 23 | 24 | public func isResponseValid(urlRequest _: URLRequest, response _: URLResponse?, data: Data?) -> Bool { 25 | guard let data = data, let responseString = String(data: data, encoding: .utf8) else { 26 | return false 27 | } 28 | return expectedResponse == responseString.trimmingCharacters(in: .whitespacesAndNewlines) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Connectivity/Classes/Response Validation/Validators/ConnectivityResponseStringValidator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectivityResponseStringValidator.swift 3 | // Connectivity 4 | // 5 | // Created by Ross Butler on 19/01/2019. 6 | // 7 | 8 | import Foundation 9 | 10 | @objc 11 | public enum ConnectivityResponseStringValidationMode: Int { 12 | case containsExpectedResponseString, 13 | equalsExpectedResponseString, 14 | matchesRegularExpression 15 | } 16 | 17 | typealias ResponseStringValidator = ConnectivityResponseStringValidator // For internal use. 18 | 19 | @objcMembers 20 | public class ConnectivityResponseStringValidator: ConnectivityResponseValidator { 21 | public typealias ValidationMode = ConnectivityResponseStringValidationMode 22 | 23 | /// The method used to validate the response from the connectivity endpoints. 24 | public let responseValidationMode: ValidationMode 25 | 26 | /// The `String` expected in the response, which is tested based on the validationMode 27 | public let expectedResponse: String 28 | 29 | /// Initializes the receiver to validate response `String`s 30 | /// using the given validation mode 31 | /// 32 | /// - Parameter validationMode: The mode to use for validating the response `String`. 33 | /// - Parameter expectedResponse: The `String` expected in the response, which is 34 | /// tested based on the validationMode 35 | public init(validationMode: ValidationMode, expectedResponse: String) { 36 | self.responseValidationMode = validationMode 37 | self.expectedResponse = expectedResponse 38 | } 39 | 40 | public func isResponseValid(urlRequest: URLRequest, response: URLResponse?, data: Data?) -> Bool { 41 | let validator: ConnectivityResponseValidator 42 | switch responseValidationMode { 43 | case .containsExpectedResponseString: 44 | validator = ConnectivityResponseContainsStringValidator( 45 | expectedResponse: expectedResponse 46 | ) 47 | case .equalsExpectedResponseString: 48 | validator = ConnectivityResponseStringEqualityValidator( 49 | expectedResponse: expectedResponse 50 | ) 51 | case .matchesRegularExpression: 52 | validator = ConnectivityResponseRegExValidator(regEx: expectedResponse) 53 | } 54 | return validator.isResponseValid(urlRequest: urlRequest, response: response, data: data) 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /ConnectivityLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rwbutler/Connectivity/30956aa751170afee0feb340714829dff159b265/ConnectivityLogo.png -------------------------------------------------------------------------------- /Example/Connectivity.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/Connectivity.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/Connectivity.xcodeproj/xcshareddata/xcschemes/Connectivity-Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 46 | 47 | 53 | 54 | 55 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 78 | 80 | 86 | 87 | 88 | 89 | 95 | 97 | 103 | 104 | 105 | 106 | 108 | 109 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /Example/Connectivity.xcodeproj/xcshareddata/xcschemes/Connectivity_Example_macOS.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 | -------------------------------------------------------------------------------- /Example/Connectivity.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/Connectivity.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/Connectivity/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Connectivity 4 | // 5 | // Created by Ross Butler on 07/15/2017. 6 | // Copyright (c) 2017 Ross Butler. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | var window: UIWindow? 14 | 15 | func application( 16 | _: UIApplication, 17 | didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? 18 | ) -> Bool { 19 | // Override point for customization after application launch. 20 | return true 21 | } 22 | 23 | func applicationWillResignActive(_: UIApplication) {} 24 | 25 | func applicationDidEnterBackground(_: UIApplication) {} 26 | 27 | func applicationWillEnterForeground(_: UIApplication) {} 28 | 29 | func applicationDidBecomeActive(_: UIApplication) {} 30 | 31 | func applicationWillTerminate(_: UIApplication) {} 32 | } 33 | -------------------------------------------------------------------------------- /Example/Connectivity/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 22 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Example/Connectivity/CombineViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CombineViewController.swift 3 | // Connectivity 4 | // 5 | // Created by Ross Butler on 05/05/2020. 6 | // Copyright © 2020 Ross Butler. All rights reserved. 7 | // 8 | 9 | #if canImport(Combine) 10 | 11 | import Combine 12 | import Connectivity 13 | import UIKit 14 | 15 | @available(iOS 13.0, *) 16 | class CombineViewController: UIViewController { 17 | // MARK: Outlets 18 | 19 | @IBOutlet var activityIndicator: UIActivityIndicatorView! 20 | @IBOutlet var notifierButton: UIButton! 21 | @IBOutlet var statusLabel: UILabel! 22 | 23 | // MARK: Status 24 | 25 | fileprivate var isCheckingConnectivity: Bool = false 26 | private var cancellable: AnyCancellable? 27 | } 28 | 29 | // IB Actions 30 | @available(iOS 13.0, *) 31 | extension CombineViewController { 32 | @IBAction func notifierButtonTapped(_: UIButton) { 33 | isCheckingConnectivity ? stopConnectivityChecks() : startConnectivityChecks() 34 | } 35 | } 36 | 37 | // Private API 38 | @available(iOS 13.0, *) 39 | private extension CombineViewController { 40 | func startConnectivityChecks() { 41 | activityIndicator.startAnimating() 42 | let publisher = Connectivity.Publisher( 43 | configuration: 44 | .init() 45 | .configureURLSession(.default) 46 | ).eraseToAnyPublisher() 47 | cancellable = publisher.receive(on: DispatchQueue.main) 48 | .sink(receiveCompletion: { [weak self] _ in 49 | guard let strongSelf = self else { 50 | return 51 | } 52 | strongSelf.activityIndicator.stopAnimating() 53 | strongSelf.isCheckingConnectivity = false 54 | strongSelf.updateNotifierButton(isCheckingConnectivity: strongSelf.isCheckingConnectivity) 55 | }, receiveValue: { [weak self] connectivity in 56 | self?.updateConnectionStatus(connectivity.status) 57 | }) 58 | isCheckingConnectivity = true 59 | updateNotifierButton(isCheckingConnectivity: isCheckingConnectivity) 60 | } 61 | 62 | func stopConnectivityChecks() { 63 | activityIndicator.stopAnimating() 64 | cancellable?.cancel() 65 | isCheckingConnectivity = false 66 | updateNotifierButton(isCheckingConnectivity: isCheckingConnectivity) 67 | } 68 | 69 | func updateConnectionStatus(_ status: Connectivity.Status) { 70 | switch status { 71 | case .connectedViaWiFi, .connectedViaCellular, .connected, .connectedViaEthernet: 72 | statusLabel.textColor = UIColor.darkGreen 73 | case .connectedViaWiFiWithoutInternet, .connectedViaCellularWithoutInternet, .connectedViaEthernetWithoutInternet, .notConnected: 74 | statusLabel.textColor = UIColor.red 75 | case .determining: 76 | statusLabel.textColor = UIColor.black 77 | } 78 | statusLabel.text = status.description 79 | } 80 | 81 | func updateNotifierButton(isCheckingConnectivity: Bool) { 82 | let buttonText = isCheckingConnectivity ? "Stop notifier" : "Start notifier" 83 | let buttonTextColor = isCheckingConnectivity ? UIColor.red : UIColor.darkGreen 84 | notifierButton.setTitle(buttonText, for: .normal) 85 | notifierButton.setTitleColor(buttonTextColor, for: .normal) 86 | } 87 | } 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /Example/Connectivity/Connectivity_Example-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | -------------------------------------------------------------------------------- /Example/Connectivity/Images.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" : "ios-marketing", 45 | "scale" : "1x", 46 | "size" : "1024x1024" 47 | } 48 | ], 49 | "info" : { 50 | "author" : "xcode", 51 | "version" : 1 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Example/Connectivity/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(MARKETING_VERSION) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Example/Connectivity/MenuViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MenuViewController.swift 3 | // Connectivity_Example 4 | // 5 | // Created by Ross Butler on 05/05/2020. 6 | // Copyright © 2020 CocoaPods. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | class MenuViewController: UIViewController { 13 | @IBOutlet var combineExampleButton: UIButton! 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | if #available(iOS 13.0, *) { 18 | combineExampleButton.isHidden = false 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Example/Connectivity/ObjCViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ObjCViewController.h 3 | // Connectivity_Example 4 | // 5 | // Created by Ross Butler on 11/14/19. 6 | // Copyright © 2019 Ross Butler. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface ObjCViewController : UIViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /Example/Connectivity/ObjCViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ObjCViewController.m 3 | // Connectivity 4 | // 5 | // Created by Ross Butler on 11/14/19. 6 | // Copyright © 2019 Ross Butler. All rights reserved. 7 | // 8 | 9 | #import "ObjCViewController.h" 10 | @import Connectivity; 11 | 12 | /// ObjCViewController included for illustrative purposes - not actually used by the sample app. 13 | @interface ObjCViewController () 14 | 15 | @property(nonatomic, strong) Connectivity *connectivity; 16 | 17 | @end 18 | 19 | @implementation ObjCViewController 20 | 21 | - (void)viewDidLoad { 22 | [super viewDidLoad]; 23 | _connectivity = [[Connectivity alloc] initWithShouldUseHTTPS:YES]; 24 | [_connectivity setFramework:ConnectivityFrameworkNetwork]; 25 | [_connectivity setWhenConnected:^(Connectivity * connectivity) { 26 | switch(connectivity.status) { 27 | case ConnectivityStatusConnected: 28 | break; 29 | case ConnectivityStatusDetermining: 30 | break; 31 | case ConnectivityStatusNotConnected: 32 | break; 33 | case ConnectivityStatusConnectedViaWiFi: 34 | break; 35 | case ConnectivityStatusConnectedViaCellular: 36 | break; 37 | case ConnectivityStatusConnectedViaWiFiWithoutInternet: 38 | break; 39 | case ConnectivityStatusConnectedViaCellularWithoutInternet: 40 | break; 41 | case ConnectivityStatusConnectedViaEthernet: 42 | break; 43 | case ConnectivityStatusConnectedViaEthernetWithoutInternet: 44 | break; 45 | } 46 | }]; 47 | [_connectivity setWhenDisconnected:^(Connectivity * connectivity) { 48 | // TODO 49 | }]; 50 | dispatch_queue_global_t backgroundQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0); 51 | [_connectivity startNotifierWithQueue:backgroundQueue]; 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /Example/Connectivity/OriginalExampleViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Connectivity 4 | // 5 | // Created by Ross Butler on 07/15/2017. 6 | // Copyright (c) 2017 Ross Butler. All rights reserved. 7 | // 8 | 9 | import Connectivity 10 | import UIKit 11 | 12 | class OriginalExampleViewController: UIViewController { 13 | // MARK: Dependencies 14 | 15 | fileprivate let connectivity = Connectivity() 16 | 17 | // MARK: Outlets 18 | 19 | @IBOutlet var activityIndicator: UIActivityIndicatorView! 20 | @IBOutlet var notifierButton: UIButton! 21 | @IBOutlet var segmentedControl: UISegmentedControl! 22 | @IBOutlet var statusLabel: UILabel! 23 | 24 | // MARK: Status 25 | 26 | fileprivate var isCheckingConnectivity: Bool = false 27 | 28 | // MARK: View controller life cycle 29 | 30 | override func viewDidLoad() { 31 | super.viewDidLoad() 32 | switch connectivity.framework { 33 | case .network: 34 | segmentedControl.selectedSegmentIndex = 1 35 | case .systemConfiguration: 36 | segmentedControl.selectedSegmentIndex = 0 37 | } 38 | performSingleConnectivityCheck() 39 | configureConnectivityNotifier() 40 | } 41 | 42 | override func didReceiveMemoryWarning() { 43 | super.didReceiveMemoryWarning() 44 | connectivity.stopNotifier() 45 | } 46 | 47 | deinit { 48 | connectivity.stopNotifier() 49 | } 50 | } 51 | 52 | // IB Actions 53 | extension OriginalExampleViewController { 54 | @IBAction func notifierButtonTapped(_: UIButton) { 55 | isCheckingConnectivity ? stopConnectivityChecks() : startConnectivityChecks() 56 | } 57 | 58 | @IBAction func segmentedControlTapped(_ sender: UISegmentedControl) { 59 | if sender.selectedSegmentIndex == 0 { 60 | connectivity.framework = .systemConfiguration 61 | } else { 62 | connectivity.framework = .network 63 | } 64 | } 65 | } 66 | 67 | // Private API 68 | private extension OriginalExampleViewController { 69 | func configureConnectivityNotifier() { 70 | let connectivityChanged: (Connectivity) -> Void = { [weak self] connectivity in 71 | self?.updateConnectionStatus(connectivity.status) 72 | } 73 | connectivity.whenConnected = connectivityChanged 74 | connectivity.whenDisconnected = connectivityChanged 75 | } 76 | 77 | func performSingleConnectivityCheck() { 78 | connectivity.checkConnectivity { connectivity in 79 | self.updateConnectionStatus(connectivity.status) 80 | } 81 | } 82 | 83 | func startConnectivityChecks() { 84 | activityIndicator.startAnimating() 85 | connectivity.startNotifier() 86 | isCheckingConnectivity = true 87 | segmentedControl.isEnabled = false 88 | updateNotifierButton(isCheckingConnectivity: isCheckingConnectivity) 89 | } 90 | 91 | func stopConnectivityChecks() { 92 | activityIndicator.stopAnimating() 93 | connectivity.stopNotifier() 94 | isCheckingConnectivity = false 95 | segmentedControl.isEnabled = true 96 | updateNotifierButton(isCheckingConnectivity: isCheckingConnectivity) 97 | } 98 | 99 | func updateConnectionStatus(_ status: Connectivity.Status) { 100 | switch status { 101 | case .connectedViaWiFi, .connectedViaCellular, .connectedViaEthernet, .connected: 102 | statusLabel.textColor = UIColor.darkGreen 103 | case .connectedViaWiFiWithoutInternet, .connectedViaCellularWithoutInternet, .connectedViaEthernetWithoutInternet, .notConnected: 104 | statusLabel.textColor = UIColor.red 105 | case .determining: 106 | statusLabel.textColor = UIColor.black 107 | } 108 | statusLabel.text = status.description 109 | segmentedControl.tintColor = statusLabel.textColor 110 | } 111 | 112 | func updateNotifierButton(isCheckingConnectivity: Bool) { 113 | let buttonText = isCheckingConnectivity ? "Stop notifier" : "Start notifier" 114 | let buttonTextColor = isCheckingConnectivity ? UIColor.red : UIColor.darkGreen 115 | notifierButton.setTitle(buttonText, for: .normal) 116 | notifierButton.setTitleColor(buttonTextColor, for: .normal) 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /Example/Connectivity/UIColorAdditions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIColorAdditions.swift 3 | // Connectivity_Example 4 | // 5 | // Created by Ross Butler on 8/18/18. 6 | // Copyright © 2018 Ross Butler. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIColor { 12 | static let darkGreen = UIColor(red: 0, green: 108 / 255, blue: 54 / 255, alpha: 1.0) 13 | } 14 | -------------------------------------------------------------------------------- /Example/Connectivity_Example_macOS/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Connectivity_Example_macOS 4 | // 5 | // Created by Philip Dukhov on 6/29/20. 6 | // Copyright © 2020 CocoaPods. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | @NSApplicationMain 12 | class AppDelegate: NSObject, NSApplicationDelegate {} 13 | -------------------------------------------------------------------------------- /Example/Connectivity_Example_macOS/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "scale" : "1x", 6 | "size" : "16x16" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "scale" : "2x", 11 | "size" : "16x16" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "scale" : "1x", 16 | "size" : "32x32" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "scale" : "2x", 21 | "size" : "32x32" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "scale" : "1x", 26 | "size" : "128x128" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "scale" : "2x", 31 | "size" : "128x128" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "scale" : "1x", 36 | "size" : "256x256" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "scale" : "2x", 41 | "size" : "256x256" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "scale" : "1x", 46 | "size" : "512x512" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "scale" : "2x", 51 | "size" : "512x512" 52 | } 53 | ], 54 | "info" : { 55 | "author" : "xcode", 56 | "version" : 1 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Example/Connectivity_Example_macOS/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Connectivity_Example_macOS/Connectivity_Example_macOS.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.files.user-selected.read-only 8 | 9 | com.apple.security.network.client 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Example/Connectivity_Example_macOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 19 | CFBundleShortVersionString 20 | $(MARKETING_VERSION) 21 | CFBundleVersion 22 | 1 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | Copyright © 2020 CocoaPods. All rights reserved. 27 | NSMainStoryboardFile 28 | Main 29 | NSPrincipalClass 30 | NSApplication 31 | NSSupportsAutomaticTermination 32 | 33 | NSSupportsSuddenTermination 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /Example/Connectivity_Example_macOS/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Connectivity_Example_macOS 4 | // 5 | // Created by Philip Dukhov on 6/29/20. 6 | // Copyright © 2020 CocoaPods. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | import Connectivity 11 | 12 | class ViewController: NSViewController { 13 | private let connectivity = Connectivity(shouldUseHTTPS: false) 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | 18 | connectivity.framework = .network 19 | connectivity.whenConnected = { connectivity in 20 | print("connectivity11", connectivity.status.description) 21 | } 22 | connectivity.whenDisconnected = { connectivity in 23 | print("connectivity12", connectivity.status.description) 24 | } 25 | connectivity.startNotifier() 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | 3 | def connectivity 4 | pod 'Connectivity', path: '../' 5 | end 6 | 7 | target 'Connectivity_Example' do 8 | connectivity 9 | 10 | target 'Connectivity_Tests' do 11 | inherit! :search_paths 12 | pod 'OHHTTPStubs/Swift' 13 | 14 | end 15 | end 16 | 17 | target 'Connectivity_Example_macOS' do 18 | connectivity 19 | end 20 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Connectivity (7.0.0) 3 | - OHHTTPStubs/Core (9.1.0) 4 | - OHHTTPStubs/Default (9.1.0): 5 | - OHHTTPStubs/Core 6 | - OHHTTPStubs/JSON 7 | - OHHTTPStubs/NSURLSession 8 | - OHHTTPStubs/OHPathHelpers 9 | - OHHTTPStubs/JSON (9.1.0): 10 | - OHHTTPStubs/Core 11 | - OHHTTPStubs/NSURLSession (9.1.0): 12 | - OHHTTPStubs/Core 13 | - OHHTTPStubs/OHPathHelpers (9.1.0) 14 | - OHHTTPStubs/Swift (9.1.0): 15 | - OHHTTPStubs/Default 16 | 17 | DEPENDENCIES: 18 | - Connectivity (from `../`) 19 | - OHHTTPStubs/Swift 20 | 21 | SPEC REPOS: 22 | trunk: 23 | - OHHTTPStubs 24 | 25 | EXTERNAL SOURCES: 26 | Connectivity: 27 | :path: "../" 28 | 29 | SPEC CHECKSUMS: 30 | Connectivity: 4d2d9a33c8deed8eab4e4c9cab245c327484155c 31 | OHHTTPStubs: 90eac6d8f2c18317baeca36698523dc67c513831 32 | 33 | PODFILE CHECKSUM: c5b723e0b586f69bc9145c603ad8a63cbc8f1194 34 | 35 | COCOAPODS: 1.15.2 36 | -------------------------------------------------------------------------------- /Example/Pods/Local Podspecs/Connectivity.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Connectivity", 3 | "version": "7.0.0", 4 | "swift_versions": "5.0", 5 | "summary": "Makes Internet connectivity detection more robust by detecting Wi-Fi networks without Internet access.", 6 | "description": "Connectivity wraps Apple's Reachability code to provide a reliable measure of whether Internet connectivity is available where Reachability alone can only indicate whether _an interface is available that might allow a connection_. Connectivity's objective is to solve the captive portal problem whereby an iOS device is connected to a Wi-Fi network lacking Internet connectivity. Such situations are commonplace and may occur for example when connecting to a public Wi-Fi network which requires the user to register before use. Connectivity can detect such situations enabling you to react accordingly.", 7 | "homepage": "https://github.com/rwbutler/Connectivity", 8 | "license": { 9 | "type": "MIT", 10 | "file": "LICENSE" 11 | }, 12 | "authors": { 13 | "Ross Butler": "github@rwbutler.com" 14 | }, 15 | "source": { 16 | "git": "https://github.com/rwbutler/Connectivity.git", 17 | "tag": "7.0.0" 18 | }, 19 | "platforms": { 20 | "ios": "12.0", 21 | "tvos": "12.0", 22 | "osx": "10.13" 23 | }, 24 | "frameworks": "SystemConfiguration", 25 | "weak_frameworks": [ 26 | "Network", 27 | "Combine" 28 | ], 29 | "source_files": "Connectivity/Classes/**/*", 30 | "resource_bundles": { 31 | "Connectivity_Privacy": [ 32 | "Example/Pods/Target\\ Support\\ Files/Connectivity-iOS/PrivacyInfo.xcprivacy" 33 | ] 34 | }, 35 | "exclude_files": [ 36 | "Connectivity/Classes/Reachability/LICENSE.txt" 37 | ], 38 | "swift_version": "5.0" 39 | } 40 | -------------------------------------------------------------------------------- /Example/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Connectivity (7.0.0) 3 | - OHHTTPStubs/Core (9.1.0) 4 | - OHHTTPStubs/Default (9.1.0): 5 | - OHHTTPStubs/Core 6 | - OHHTTPStubs/JSON 7 | - OHHTTPStubs/NSURLSession 8 | - OHHTTPStubs/OHPathHelpers 9 | - OHHTTPStubs/JSON (9.1.0): 10 | - OHHTTPStubs/Core 11 | - OHHTTPStubs/NSURLSession (9.1.0): 12 | - OHHTTPStubs/Core 13 | - OHHTTPStubs/OHPathHelpers (9.1.0) 14 | - OHHTTPStubs/Swift (9.1.0): 15 | - OHHTTPStubs/Default 16 | 17 | DEPENDENCIES: 18 | - Connectivity (from `../`) 19 | - OHHTTPStubs/Swift 20 | 21 | SPEC REPOS: 22 | trunk: 23 | - OHHTTPStubs 24 | 25 | EXTERNAL SOURCES: 26 | Connectivity: 27 | :path: "../" 28 | 29 | SPEC CHECKSUMS: 30 | Connectivity: 4d2d9a33c8deed8eab4e4c9cab245c327484155c 31 | OHHTTPStubs: 90eac6d8f2c18317baeca36698523dc67c513831 32 | 33 | PODFILE CHECKSUM: c5b723e0b586f69bc9145c603ad8a63cbc8f1194 34 | 35 | COCOAPODS: 1.15.2 36 | -------------------------------------------------------------------------------- /Example/Pods/OHHTTPStubs/LICENSE: -------------------------------------------------------------------------------- 1 | - MIT LICENSE - 2 | 3 | Copyright (c) 2012 Olivier Halligon 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /Example/Pods/OHHTTPStubs/Sources/OHHTTPStubs/HTTPStubs+NSURLSessionConfiguration.m: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * 3 | * Copyright (c) 2012 Olivier Halligon 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 13 | * all 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 21 | * THE SOFTWARE. 22 | * 23 | ***********************************************************************************/ 24 | 25 | #import 26 | 27 | #if defined(__IPHONE_7_0) || defined(__MAC_10_9) 28 | #import "HTTPStubs.h" 29 | #import "HTTPStubsMethodSwizzling.h" 30 | 31 | ////////////////////////////////////////////////////////////////////////////////////////////////// 32 | 33 | /** 34 | * This helper is used to swizzle NSURLSessionConfiguration constructor methods 35 | * defaultSessionConfiguration and ephemeralSessionConfiguration to insert the private 36 | * HTTPStubsProtocol into their protocolClasses array so that OHHTTPStubs is automagically 37 | * supported when you create a new NSURLSession based on one of there configurations. 38 | */ 39 | 40 | typedef NSURLSessionConfiguration*(*SessionConfigConstructor)(id,SEL); 41 | static SessionConfigConstructor orig_defaultSessionConfiguration; 42 | static SessionConfigConstructor orig_ephemeralSessionConfiguration; 43 | 44 | static NSURLSessionConfiguration* HTTPStubs_defaultSessionConfiguration(id self, SEL _cmd) 45 | { 46 | NSURLSessionConfiguration* config = orig_defaultSessionConfiguration(self,_cmd); // call original method 47 | [HTTPStubs setEnabled:YES forSessionConfiguration:config]; //OHHTTPStubsAddProtocolClassToNSURLSessionConfiguration(config); 48 | return config; 49 | } 50 | 51 | static NSURLSessionConfiguration* HTTPStubs_ephemeralSessionConfiguration(id self, SEL _cmd) 52 | { 53 | NSURLSessionConfiguration* config = orig_ephemeralSessionConfiguration(self,_cmd); // call original method 54 | [HTTPStubs setEnabled:YES forSessionConfiguration:config]; //OHHTTPStubsAddProtocolClassToNSURLSessionConfiguration(config); 55 | return config; 56 | } 57 | 58 | @interface NSURLSessionConfiguration(HTTPStubsSupport) @end 59 | 60 | @implementation NSURLSessionConfiguration(HTTPStubsSupport) 61 | 62 | +(void)load 63 | { 64 | orig_defaultSessionConfiguration = (SessionConfigConstructor)HTTPStubsReplaceMethod(@selector(defaultSessionConfiguration), 65 | (IMP)HTTPStubs_defaultSessionConfiguration, 66 | [NSURLSessionConfiguration class], 67 | YES); 68 | orig_ephemeralSessionConfiguration = (SessionConfigConstructor)HTTPStubsReplaceMethod(@selector(ephemeralSessionConfiguration), 69 | (IMP)HTTPStubs_ephemeralSessionConfiguration, 70 | [NSURLSessionConfiguration class], 71 | YES); 72 | } 73 | 74 | @end 75 | 76 | #endif /* __IPHONE_7_0 || __MAC_10_9 */ 77 | 78 | 79 | -------------------------------------------------------------------------------- /Example/Pods/OHHTTPStubs/Sources/OHHTTPStubs/HTTPStubsMethodSwizzling.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * 3 | * Copyright (c) 2012 Olivier Halligon, 2016 Sebastian Hagedorn 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 13 | * all 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 21 | * THE SOFTWARE. 22 | * 23 | ***********************************************************************************/ 24 | 25 | //////////////////////////////////////////////////////////////////////////////// 26 | #pragma mark - Imports 27 | 28 | #import 29 | 30 | //////////////////////////////////////////////////////////////////////////////// 31 | #pragma mark - Method Swizzling Helpers 32 | 33 | /** 34 | * Replaces the selector's associated method implementation with the 35 | * given implementation (or adds it, if there was no existing one). 36 | * 37 | * @param selector The selector entry in the dispatch table. 38 | * @param newImpl The implementation that will be associated with 39 | * the given selector. 40 | * @param affectedClass The class whose dispatch table will be altered. 41 | * @param isClassMethod Set to YES if the selector denotes a class 42 | * method, or NO if it is an instance method. 43 | * @return The previous implementation associated with 44 | * the swizzled selector. You should store the 45 | * implementation and call it when overwriting 46 | * the selector. 47 | */ 48 | __attribute__((warn_unused_result)) IMP HTTPStubsReplaceMethod(SEL selector, 49 | IMP newImpl, 50 | Class affectedClass, 51 | BOOL isClassMethod); 52 | -------------------------------------------------------------------------------- /Example/Pods/OHHTTPStubs/Sources/OHHTTPStubs/HTTPStubsMethodSwizzling.m: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * 3 | * Copyright (c) 2012 Olivier Halligon, 2016 Sebastian Hagedorn 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 13 | * all 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 21 | * THE SOFTWARE. 22 | * 23 | ***********************************************************************************/ 24 | 25 | //////////////////////////////////////////////////////////////////////////////// 26 | #pragma mark - Imports 27 | 28 | #import "HTTPStubsMethodSwizzling.h" 29 | 30 | ////////////////////////////////////////////////////////////////////////////////////////////////// 31 | #pragma mark - Method Swizzling Helpers 32 | 33 | IMP HTTPStubsReplaceMethod(SEL selector, 34 | IMP newImpl, 35 | Class affectedClass, 36 | BOOL isClassMethod) 37 | { 38 | Method origMethod = isClassMethod ? class_getClassMethod(affectedClass, selector) : class_getInstanceMethod(affectedClass, selector); 39 | IMP origImpl = method_getImplementation(origMethod); 40 | 41 | if (!class_addMethod(isClassMethod ? object_getClass(affectedClass) : affectedClass, selector, newImpl, method_getTypeEncoding(origMethod))) 42 | { 43 | method_setImplementation(origMethod, newImpl); 44 | } 45 | 46 | return origImpl; 47 | } 48 | -------------------------------------------------------------------------------- /Example/Pods/OHHTTPStubs/Sources/OHHTTPStubs/HTTPStubsPathHelpers.m: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * 3 | * Copyright (c) 2012 Olivier Halligon 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 13 | * all 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 21 | * THE SOFTWARE. 22 | * 23 | ***********************************************************************************/ 24 | 25 | 26 | #import "HTTPStubsPathHelpers.h" 27 | 28 | NSString* __nullable OHPathForFile(NSString* fileName, Class inBundleForClass) 29 | { 30 | NSBundle* bundle = [NSBundle bundleForClass:inBundleForClass]; 31 | return OHPathForFileInBundle(fileName, bundle); 32 | } 33 | 34 | NSString* __nullable OHPathForFileInBundle(NSString* fileName, NSBundle* bundle) 35 | { 36 | return [bundle pathForResource:[fileName stringByDeletingPathExtension] 37 | ofType:[fileName pathExtension]]; 38 | } 39 | 40 | NSString* __nullable OHPathForFileInDocumentsDir(NSString* fileName) 41 | { 42 | NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 43 | NSString *basePath = (paths.count > 0) ? paths[0] : nil; 44 | return [basePath stringByAppendingPathComponent:fileName]; 45 | } 46 | 47 | NSBundle* __nullable OHResourceBundle(NSString* bundleBasename, Class inBundleForClass) 48 | { 49 | NSBundle* classBundle = [NSBundle bundleForClass:inBundleForClass]; 50 | return [NSBundle bundleWithPath:[classBundle pathForResource:bundleBasename 51 | ofType:@"bundle"]]; 52 | } 53 | -------------------------------------------------------------------------------- /Example/Pods/OHHTTPStubs/Sources/OHHTTPStubs/HTTPStubsResponse+JSON.m: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * 3 | * Copyright (c) 2012 Olivier Halligon 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 13 | * all 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 21 | * THE SOFTWARE. 22 | * 23 | ***********************************************************************************/ 24 | 25 | 26 | #import "HTTPStubsResponse+JSON.h" 27 | 28 | @implementation HTTPStubsResponse (JSON) 29 | 30 | /*! @name Building a response from JSON objects */ 31 | 32 | + (instancetype)responseWithJSONObject:(id)jsonObject 33 | statusCode:(int)statusCode 34 | headers:(nullable NSDictionary *)httpHeaders 35 | { 36 | if (!httpHeaders[@"Content-Type"]) 37 | { 38 | NSMutableDictionary* mutableHeaders = [NSMutableDictionary dictionaryWithDictionary:httpHeaders]; 39 | mutableHeaders[@"Content-Type"] = @"application/json"; 40 | httpHeaders = [NSDictionary dictionaryWithDictionary:mutableHeaders]; // make immutable again 41 | } 42 | 43 | return [self responseWithData:[NSJSONSerialization dataWithJSONObject:jsonObject options:0 error:nil] 44 | statusCode:statusCode 45 | headers:httpHeaders]; 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Example/Pods/OHHTTPStubs/Sources/OHHTTPStubs/NSURLRequest+HTTPBodyTesting.m: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * 3 | * Copyright (c) 2016 Sebastian Hagedorn, Felix Lamouroux 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 13 | * all 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 21 | * THE SOFTWARE. 22 | * 23 | ***********************************************************************************/ 24 | 25 | #import "NSURLRequest+HTTPBodyTesting.h" 26 | 27 | #if defined(__IPHONE_7_0) || defined(__MAC_10_9) 28 | 29 | //////////////////////////////////////////////////////////////////////////////// 30 | #pragma mark - Imports 31 | 32 | #import "HTTPStubsMethodSwizzling.h" 33 | 34 | //////////////////////////////////////////////////////////////////////////////// 35 | #pragma mark - NSURLRequest+CustomHTTPBody 36 | 37 | NSString * const OHHTTPStubs_HTTPBodyKey = @"HTTPBody"; 38 | 39 | @implementation NSURLRequest (HTTPBodyTesting) 40 | 41 | - (NSData*)OHHTTPStubs_HTTPBody 42 | { 43 | return [NSURLProtocol propertyForKey:OHHTTPStubs_HTTPBodyKey inRequest:self]; 44 | } 45 | 46 | @end 47 | 48 | //////////////////////////////////////////////////////////////////////////////// 49 | #pragma mark - NSMutableURLRequest+HTTPBodyTesting 50 | 51 | typedef void(*HTTPStubsSetterIMP)(id, SEL, id); 52 | static HTTPStubsSetterIMP orig_setHTTPBody; 53 | 54 | static void OHHTTPStubs_setHTTPBody(id self, SEL _cmd, NSData* HTTPBody) 55 | { 56 | // store the http body via NSURLProtocol 57 | if (HTTPBody) { 58 | [NSURLProtocol setProperty:HTTPBody forKey:OHHTTPStubs_HTTPBodyKey inRequest:self]; 59 | } else { 60 | // unfortunately resetting does not work properly as the NSURLSession also uses this to reset the property 61 | } 62 | 63 | orig_setHTTPBody(self, _cmd, HTTPBody); 64 | } 65 | 66 | /** 67 | * Swizzles setHTTPBody: in order to maintain a copy of the http body for later 68 | * reference and calls the original implementation. 69 | * 70 | * @warning Should not be used in production, testing only. 71 | */ 72 | @interface NSMutableURLRequest (HTTPBodyTesting) @end 73 | 74 | @implementation NSMutableURLRequest (HTTPBodyTesting) 75 | 76 | + (void)load 77 | { 78 | orig_setHTTPBody = (HTTPStubsSetterIMP)HTTPStubsReplaceMethod(@selector(setHTTPBody:), 79 | (IMP)OHHTTPStubs_setHTTPBody, 80 | [NSMutableURLRequest class], 81 | NO); 82 | } 83 | 84 | @end 85 | 86 | #endif /* __IPHONE_7_0 || __MAC_10_9 */ 87 | -------------------------------------------------------------------------------- /Example/Pods/OHHTTPStubs/Sources/OHHTTPStubs/include/Compatibility.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * 3 | * Copyright (c) 2012 Olivier Halligon 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 13 | * all 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 21 | * THE SOFTWARE. 22 | * 23 | ***********************************************************************************/ 24 | 25 | 26 | /* 27 | * This file allows to keep compatibility with older SDKs which didn't have 28 | * the latest features and associated macros yet. 29 | */ 30 | 31 | 32 | #ifndef NS_DESIGNATED_INITIALIZER 33 | #if __has_attribute(objc_designated_initializer) 34 | #define NS_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer)) 35 | #else 36 | #define NS_DESIGNATED_INITIALIZER 37 | #endif 38 | #endif 39 | 40 | // Allow to use nullability macros and keywords even if not supported yet 41 | #if ! __has_feature(nullability) 42 | #define NS_ASSUME_NONNULL_BEGIN 43 | #define NS_ASSUME_NONNULL_END 44 | #define nullable 45 | #define __nullable 46 | #define __nonnull 47 | #endif 48 | -------------------------------------------------------------------------------- /Example/Pods/OHHTTPStubs/Sources/OHHTTPStubs/include/HTTPStubsPathHelpers.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * 3 | * Copyright (c) 2012 Olivier Halligon 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 13 | * all 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 21 | * THE SOFTWARE. 22 | * 23 | ***********************************************************************************/ 24 | 25 | 26 | #import 27 | 28 | #import "Compatibility.h" 29 | 30 | NS_ASSUME_NONNULL_BEGIN 31 | 32 | /** 33 | * Useful function to build a path given a file name and a class. 34 | * 35 | * @param fileName The name of the file to get the path to, including file extension 36 | * @param inBundleForClass The class of the caller, used to determine the current bundle 37 | * in which the file is supposed to be located. 38 | * You should typically pass `self.class` (ObjC) or 39 | * `self.dynamicType` (Swift < 3.0) or `type(of: self)` (Swift >= 3.0) when calling this function. 40 | * 41 | * @return The path of the given file in the same bundle as the inBundleForClass class 42 | */ 43 | NSString* __nullable OHPathForFile(NSString* fileName, Class inBundleForClass); 44 | 45 | /** 46 | * Useful function to build a path given a file name and a bundle. 47 | * 48 | * @param fileName The name of the file to get the path to, including file extension 49 | * @param bundle The bundle in which the file is supposed to be located. 50 | * This parameter can't be null. 51 | * 52 | * @return The path of the given file in given bundle 53 | * 54 | * @note You should avoid using `[NSBundle mainBundle]` for the `bundle` parameter, 55 | * as in the context of Unit Tests, this points to the Simulator's bundle, 56 | * not the bundle of the app under test. That's why `nil` is not an acceptable 57 | * value (so you won't expect it to default to the `mainBundle`). 58 | * You should use `[NSBundle bundleForClass:]` instead. 59 | */ 60 | NSString* __nullable OHPathForFileInBundle(NSString* fileName, NSBundle* bundle); 61 | 62 | /** 63 | * Useful function to build a path to a file in the Documents's directory in the 64 | * app sandbox, used by iTunes File Sharing for example. 65 | * 66 | * @param fileName The name of the file to get the path to, including file extension 67 | * 68 | * @return The path of the file in the Documents directory in your App Sandbox 69 | */ 70 | NSString* __nullable OHPathForFileInDocumentsDir(NSString* fileName); 71 | 72 | 73 | 74 | /** 75 | * Useful function to build an NSBundle located in the application's resources simply from its name 76 | * 77 | * @param bundleBasename The base name, without extension (extension is assumed to be ".bundle"). 78 | * @param inBundleForClass The class of the caller, used to determine the current bundle 79 | * in which the file is supposed to be located. 80 | * You should typically pass `self.class` (ObjC) or 81 | * `self.dynamicType` (Swift) when calling this function. 82 | * 83 | * @return The NSBundle object representing the bundle with the given basename located in your application's resources. 84 | */ 85 | NSBundle* __nullable OHResourceBundle(NSString* bundleBasename, Class inBundleForClass); 86 | 87 | NS_ASSUME_NONNULL_END 88 | -------------------------------------------------------------------------------- /Example/Pods/OHHTTPStubs/Sources/OHHTTPStubs/include/HTTPStubsResponse+JSON.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * 3 | * Copyright (c) 2012 Olivier Halligon 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 13 | * all 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 21 | * THE SOFTWARE. 22 | * 23 | ***********************************************************************************/ 24 | 25 | 26 | #import "HTTPStubsResponse.h" 27 | #import "Compatibility.h" 28 | 29 | NS_ASSUME_NONNULL_BEGIN 30 | 31 | /** 32 | * Adds convenience methods to manipulate JSON objects directly. 33 | * Pass in an `NSDictionary` or `NSArray` to generate a corresponding JSON output. 34 | */ 35 | @interface HTTPStubsResponse (JSON) 36 | 37 | /** 38 | * Builds a response given a JSON object for the response body, status code, and headers. 39 | * 40 | * @param jsonObject Object representing the response body. 41 | * Typically a `NSDictionary`; may be any object accepted by `+[NSJSONSerialization dataWithJSONObject:options:error:]` 42 | * @param statusCode The HTTP Status Code to use in the response 43 | * @param httpHeaders The HTTP Headers to return in the response 44 | * If a "Content-Type" header is not included, "Content-Type: application/json" will be added. 45 | * 46 | * @return An `HTTPStubsResponse` describing the corresponding response to return by the stub 47 | * 48 | * @note This method typically calls `responseWithData:statusCode:headers:`, passing the serialized JSON 49 | * object as the data parameter and adding the Content-Type header if necessary. 50 | */ 51 | + (instancetype)responseWithJSONObject:(id)jsonObject 52 | statusCode:(int)statusCode 53 | headers:(nullable NSDictionary *)httpHeaders; 54 | 55 | @end 56 | 57 | NS_ASSUME_NONNULL_END 58 | -------------------------------------------------------------------------------- /Example/Pods/OHHTTPStubs/Sources/OHHTTPStubs/include/NSURLRequest+HTTPBodyTesting.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * 3 | * Copyright (c) 2016 Sebastian Hagedorn, Felix Lamouroux 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 13 | * all 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 21 | * THE SOFTWARE. 22 | * 23 | ***********************************************************************************/ 24 | 25 | //////////////////////////////////////////////////////////////////////////////// 26 | #pragma mark - Imports 27 | 28 | #import 29 | 30 | // This category is only useful when NSURLSession is present 31 | #if defined(__IPHONE_7_0) || defined(__MAC_10_9) 32 | 33 | //////////////////////////////////////////////////////////////////////////////// 34 | #pragma mark - NSURLRequest+HTTPBodyTesting 35 | 36 | @interface NSURLRequest (HTTPBodyTesting) 37 | /** 38 | * Unfortunately, when sending POST requests (with a body) using NSURLSession, 39 | * by the time the request arrives at OHHTTPStubs, the HTTPBody of the 40 | * NSURLRequest has been reset to nil. 41 | * 42 | * You can use this method to retrieve the HTTPBody for testing and use it to 43 | * conditionally stub your requests. 44 | */ 45 | - (NSData *)OHHTTPStubs_HTTPBody; 46 | @end 47 | 48 | #endif /* __IPHONE_7_0 || __MAC_10_9 */ 49 | -------------------------------------------------------------------------------- /Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Connectivity-iOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 53 | 54 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Connectivity-macOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 53 | 54 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Connectivity-iOS/Connectivity-iOS-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | ${PODS_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 | FMWK 17 | CFBundleShortVersionString 18 | 8.0.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Connectivity-iOS/Connectivity-iOS-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Connectivity_iOS : NSObject 3 | @end 4 | @implementation PodsDummy_Connectivity_iOS 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Connectivity-iOS/Connectivity-iOS-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Connectivity-iOS/Connectivity-iOS-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "Reachability.h" 14 | 15 | FOUNDATION_EXPORT double ConnectivityVersionNumber; 16 | FOUNDATION_EXPORT const unsigned char ConnectivityVersionString[]; 17 | 18 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Connectivity-iOS/Connectivity-iOS.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Connectivity-iOS 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift 5 | OTHER_LDFLAGS = $(inherited) -framework "SystemConfiguration" -weak_framework "Combine" -weak_framework "Network" 6 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 7 | PODS_BUILD_DIR = ${BUILD_DIR} 8 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 9 | PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} 10 | PODS_ROOT = ${SRCROOT} 11 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../.. 12 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 13 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 14 | SKIP_INSTALL = YES 15 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 16 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Connectivity-iOS/Connectivity-iOS.modulemap: -------------------------------------------------------------------------------- 1 | framework module Connectivity { 2 | umbrella header "Connectivity-iOS-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Connectivity-iOS/Connectivity-iOS.release.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Connectivity-iOS 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift 5 | OTHER_LDFLAGS = $(inherited) -framework "SystemConfiguration" -weak_framework "Combine" -weak_framework "Network" 6 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 7 | PODS_BUILD_DIR = ${BUILD_DIR} 8 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 9 | PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} 10 | PODS_ROOT = ${SRCROOT} 11 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../.. 12 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 13 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 14 | SKIP_INSTALL = YES 15 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 16 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Connectivity-iOS/PrivacyInfo.xcprivacy: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSPrivacyTracking 6 | 7 | NSPrivacyTrackingDomains 8 | 9 | NSPrivacyCollectedDataTypes 10 | 11 | 12 | NSPrivacyCollectedDataType 13 | 14 | NSPrivacyCollectedDataTypeLinked 15 | 16 | NSPrivacyCollectedDataTypeTracking 17 | 18 | NSPrivacyCollectedDataTypePurposes 19 | 20 | 21 | 22 | 23 | 24 | NSPrivacyAccessedAPITypes 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Connectivity-iOS/ResourceBundle-Connectivity_Privacy-Connectivity-iOS-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | ${PODS_DEVELOPMENT_LANGUAGE} 7 | CFBundleIdentifier 8 | ${PRODUCT_BUNDLE_IDENTIFIER} 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundleName 12 | ${PRODUCT_NAME} 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 8.0.1 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Connectivity-macOS/Connectivity-macOS-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | ${PODS_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 | FMWK 17 | CFBundleShortVersionString 18 | 8.0.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Connectivity-macOS/Connectivity-macOS-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Connectivity_macOS : NSObject 3 | @end 4 | @implementation PodsDummy_Connectivity_macOS 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Connectivity-macOS/Connectivity-macOS-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Connectivity-macOS/Connectivity-macOS-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "Reachability.h" 14 | 15 | FOUNDATION_EXPORT double ConnectivityVersionNumber; 16 | FOUNDATION_EXPORT const unsigned char ConnectivityVersionString[]; 17 | 18 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Connectivity-macOS/Connectivity-macOS.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | CODE_SIGN_IDENTITY = 3 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Connectivity-macOS 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift 6 | OTHER_LDFLAGS = $(inherited) -framework "SystemConfiguration" -weak_framework "Combine" -weak_framework "Network" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} 11 | PODS_ROOT = ${SRCROOT} 12 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../.. 13 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 14 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 15 | SKIP_INSTALL = YES 16 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Connectivity-macOS/Connectivity-macOS.modulemap: -------------------------------------------------------------------------------- 1 | framework module Connectivity { 2 | umbrella header "Connectivity-macOS-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Connectivity-macOS/Connectivity-macOS.release.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | CODE_SIGN_IDENTITY = 3 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Connectivity-macOS 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift 6 | OTHER_LDFLAGS = $(inherited) -framework "SystemConfiguration" -weak_framework "Combine" -weak_framework "Network" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} 11 | PODS_ROOT = ${SRCROOT} 12 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../.. 13 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 14 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 15 | SKIP_INSTALL = YES 16 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Connectivity-macOS/ResourceBundle-Connectivity_Privacy-Connectivity-macOS-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | ${PODS_DEVELOPMENT_LANGUAGE} 7 | CFBundleIdentifier 8 | ${PRODUCT_BUNDLE_IDENTIFIER} 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundleName 12 | ${PRODUCT_NAME} 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 8.0.1 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/OHHTTPStubs/OHHTTPStubs-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | ${PODS_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 | FMWK 17 | CFBundleShortVersionString 18 | 9.1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/OHHTTPStubs/OHHTTPStubs-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_OHHTTPStubs : NSObject 3 | @end 4 | @implementation PodsDummy_OHHTTPStubs 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/OHHTTPStubs/OHHTTPStubs-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/OHHTTPStubs/OHHTTPStubs-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "HTTPStubs.h" 14 | #import "HTTPStubsResponse.h" 15 | #import "Compatibility.h" 16 | #import "HTTPStubsResponse+JSON.h" 17 | #import "NSURLRequest+HTTPBodyTesting.h" 18 | #import "HTTPStubsPathHelpers.h" 19 | #import "Compatibility.h" 20 | 21 | FOUNDATION_EXPORT double OHHTTPStubsVersionNumber; 22 | FOUNDATION_EXPORT const unsigned char OHHTTPStubsVersionString[]; 23 | 24 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/OHHTTPStubs/OHHTTPStubs.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/OHHTTPStubs 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift 5 | OTHER_LDFLAGS = $(inherited) -framework "CFNetwork" -framework "Foundation" 6 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 7 | PODS_BUILD_DIR = ${BUILD_DIR} 8 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 9 | PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} 10 | PODS_ROOT = ${SRCROOT} 11 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/OHHTTPStubs 12 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 13 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 14 | SKIP_INSTALL = YES 15 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 16 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/OHHTTPStubs/OHHTTPStubs.modulemap: -------------------------------------------------------------------------------- 1 | framework module OHHTTPStubs { 2 | umbrella header "OHHTTPStubs-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/OHHTTPStubs/OHHTTPStubs.release.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/OHHTTPStubs 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift 5 | OTHER_LDFLAGS = $(inherited) -framework "CFNetwork" -framework "Foundation" 6 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 7 | PODS_BUILD_DIR = ${BUILD_DIR} 8 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 9 | PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} 10 | PODS_ROOT = ${SRCROOT} 11 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/OHHTTPStubs 12 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 13 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 14 | SKIP_INSTALL = YES 15 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 16 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Example/Pods-Connectivity_Example-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | ${PODS_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 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Example/Pods-Connectivity_Example-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## Connectivity 5 | 6 | Copyright (c) 2017 - 2018 Ross Butler 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | 26 | Generated by CocoaPods - https://cocoapods.org 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Example/Pods-Connectivity_Example-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Copyright (c) 2017 - 2018 Ross Butler 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy 20 | of this software and associated documentation files (the "Software"), to deal 21 | in the Software without restriction, including without limitation the rights 22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | copies of the Software, and to permit persons to whom the Software is 24 | furnished to do so, subject to the following conditions: 25 | 26 | The above copyright notice and this permission notice shall be included in 27 | all copies or substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 35 | THE SOFTWARE. 36 | 37 | License 38 | MIT 39 | Title 40 | Connectivity 41 | Type 42 | PSGroupSpecifier 43 | 44 | 45 | FooterText 46 | Generated by CocoaPods - https://cocoapods.org 47 | Title 48 | 49 | Type 50 | PSGroupSpecifier 51 | 52 | 53 | StringsTable 54 | Acknowledgements 55 | Title 56 | Acknowledgements 57 | 58 | 59 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Example/Pods-Connectivity_Example-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_Connectivity_Example : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_Connectivity_Example 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Example/Pods-Connectivity_Example-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | function on_error { 7 | echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" 8 | } 9 | trap 'on_error $LINENO' ERR 10 | 11 | if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then 12 | # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy 13 | # frameworks to, so exit 0 (signalling the script phase was successful). 14 | exit 0 15 | fi 16 | 17 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 18 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 19 | 20 | COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" 21 | SWIFT_STDLIB_PATH="${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 22 | BCSYMBOLMAP_DIR="BCSymbolMaps" 23 | 24 | 25 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 26 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 27 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 28 | 29 | # Copies and strips a vendored framework 30 | install_framework() 31 | { 32 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 33 | local source="${BUILT_PRODUCTS_DIR}/$1" 34 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 35 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 36 | elif [ -r "$1" ]; then 37 | local source="$1" 38 | fi 39 | 40 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 41 | 42 | if [ -L "${source}" ]; then 43 | echo "Symlinked..." 44 | source="$(readlink -f "${source}")" 45 | fi 46 | 47 | if [ -d "${source}/${BCSYMBOLMAP_DIR}" ]; then 48 | # Locate and install any .bcsymbolmaps if present, and remove them from the .framework before the framework is copied 49 | find "${source}/${BCSYMBOLMAP_DIR}" -name "*.bcsymbolmap"|while read f; do 50 | echo "Installing $f" 51 | install_bcsymbolmap "$f" "$destination" 52 | rm "$f" 53 | done 54 | rmdir "${source}/${BCSYMBOLMAP_DIR}" 55 | fi 56 | 57 | # Use filter instead of exclude so missing patterns don't throw errors. 58 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 59 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 60 | 61 | local basename 62 | basename="$(basename -s .framework "$1")" 63 | binary="${destination}/${basename}.framework/${basename}" 64 | 65 | if ! [ -r "$binary" ]; then 66 | binary="${destination}/${basename}" 67 | elif [ -L "${binary}" ]; then 68 | echo "Destination binary is symlinked..." 69 | dirname="$(dirname "${binary}")" 70 | binary="${dirname}/$(readlink "${binary}")" 71 | fi 72 | 73 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 74 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 75 | strip_invalid_archs "$binary" 76 | fi 77 | 78 | # Resign the code if required by the build settings to avoid unstable apps 79 | code_sign_if_enabled "${destination}/$(basename "$1")" 80 | 81 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 82 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 83 | local swift_runtime_libs 84 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u) 85 | for lib in $swift_runtime_libs; do 86 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 87 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 88 | code_sign_if_enabled "${destination}/${lib}" 89 | done 90 | fi 91 | } 92 | # Copies and strips a vendored dSYM 93 | install_dsym() { 94 | local source="$1" 95 | warn_missing_arch=${2:-true} 96 | if [ -r "$source" ]; then 97 | # Copy the dSYM into the targets temp dir. 98 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" 99 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" 100 | 101 | local basename 102 | basename="$(basename -s .dSYM "$source")" 103 | binary_name="$(ls "$source/Contents/Resources/DWARF")" 104 | binary="${DERIVED_FILES_DIR}/${basename}.dSYM/Contents/Resources/DWARF/${binary_name}" 105 | 106 | # Strip invalid architectures from the dSYM. 107 | if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then 108 | strip_invalid_archs "$binary" "$warn_missing_arch" 109 | fi 110 | if [[ $STRIP_BINARY_RETVAL == 0 ]]; then 111 | # Move the stripped file into its final destination. 112 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" 113 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.dSYM" "${DWARF_DSYM_FOLDER_PATH}" 114 | else 115 | # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. 116 | mkdir -p "${DWARF_DSYM_FOLDER_PATH}" 117 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.dSYM" 118 | fi 119 | fi 120 | } 121 | 122 | # Used as a return value for each invocation of `strip_invalid_archs` function. 123 | STRIP_BINARY_RETVAL=0 124 | 125 | # Strip invalid architectures 126 | strip_invalid_archs() { 127 | binary="$1" 128 | warn_missing_arch=${2:-true} 129 | # Get architectures for current target binary 130 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" 131 | # Intersect them with the architectures we are building for 132 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" 133 | # If there are no archs supported by this binary then warn the user 134 | if [[ -z "$intersected_archs" ]]; then 135 | if [[ "$warn_missing_arch" == "true" ]]; then 136 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." 137 | fi 138 | STRIP_BINARY_RETVAL=1 139 | return 140 | fi 141 | stripped="" 142 | for arch in $binary_archs; do 143 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 144 | # Strip non-valid architectures in-place 145 | lipo -remove "$arch" -output "$binary" "$binary" 146 | stripped="$stripped $arch" 147 | fi 148 | done 149 | if [[ "$stripped" ]]; then 150 | echo "Stripped $binary of architectures:$stripped" 151 | fi 152 | STRIP_BINARY_RETVAL=0 153 | } 154 | 155 | # Copies the bcsymbolmap files of a vendored framework 156 | install_bcsymbolmap() { 157 | local bcsymbolmap_path="$1" 158 | local destination="${BUILT_PRODUCTS_DIR}" 159 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"" 160 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}" 161 | } 162 | 163 | # Signs a framework with the provided identity 164 | code_sign_if_enabled() { 165 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 166 | # Use the current code_sign_identity 167 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 168 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" 169 | 170 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 171 | code_sign_cmd="$code_sign_cmd &" 172 | fi 173 | echo "$code_sign_cmd" 174 | eval "$code_sign_cmd" 175 | fi 176 | } 177 | 178 | if [[ "$CONFIGURATION" == "Debug" ]]; then 179 | install_framework "${BUILT_PRODUCTS_DIR}/Connectivity-iOS/Connectivity.framework" 180 | fi 181 | if [[ "$CONFIGURATION" == "Release" ]]; then 182 | install_framework "${BUILT_PRODUCTS_DIR}/Connectivity-iOS/Connectivity.framework" 183 | fi 184 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 185 | wait 186 | fi 187 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Example/Pods-Connectivity_Example-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_Connectivity_ExampleVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_Connectivity_ExampleVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Example/Pods-Connectivity_Example.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Connectivity-iOS" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Connectivity-iOS/Connectivity.framework/Headers" 6 | LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift '@executable_path/Frameworks' '@loader_path/Frameworks' 7 | LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift 8 | OTHER_LDFLAGS = $(inherited) -framework "Connectivity" -framework "SystemConfiguration" -weak_framework "Combine" -weak_framework "Network" 9 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 10 | PODS_BUILD_DIR = ${BUILD_DIR} 11 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 12 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 13 | PODS_ROOT = ${SRCROOT}/Pods 14 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 15 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 16 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Example/Pods-Connectivity_Example.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_Connectivity_Example { 2 | umbrella header "Pods-Connectivity_Example-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Example/Pods-Connectivity_Example.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Connectivity-iOS" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Connectivity-iOS/Connectivity.framework/Headers" 6 | LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift '@executable_path/Frameworks' '@loader_path/Frameworks' 7 | LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift 8 | OTHER_LDFLAGS = $(inherited) -framework "Connectivity" -framework "SystemConfiguration" -weak_framework "Combine" -weak_framework "Network" 9 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 10 | PODS_BUILD_DIR = ${BUILD_DIR} 11 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 12 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 13 | PODS_ROOT = ${SRCROOT}/Pods 14 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 15 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 16 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Example_macOS/Pods-Connectivity_Example_macOS-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | ${PODS_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 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Example_macOS/Pods-Connectivity_Example_macOS-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## Connectivity 5 | 6 | Copyright (c) 2017 - 2018 Ross Butler 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | 26 | Generated by CocoaPods - https://cocoapods.org 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Example_macOS/Pods-Connectivity_Example_macOS-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Copyright (c) 2017 - 2018 Ross Butler 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy 20 | of this software and associated documentation files (the "Software"), to deal 21 | in the Software without restriction, including without limitation the rights 22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | copies of the Software, and to permit persons to whom the Software is 24 | furnished to do so, subject to the following conditions: 25 | 26 | The above copyright notice and this permission notice shall be included in 27 | all copies or substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 35 | THE SOFTWARE. 36 | 37 | License 38 | MIT 39 | Title 40 | Connectivity 41 | Type 42 | PSGroupSpecifier 43 | 44 | 45 | FooterText 46 | Generated by CocoaPods - https://cocoapods.org 47 | Title 48 | 49 | Type 50 | PSGroupSpecifier 51 | 52 | 53 | StringsTable 54 | Acknowledgements 55 | Title 56 | Acknowledgements 57 | 58 | 59 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Example_macOS/Pods-Connectivity_Example_macOS-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_Connectivity_Example_macOS : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_Connectivity_Example_macOS 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Example_macOS/Pods-Connectivity_Example_macOS-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | function on_error { 7 | echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" 8 | } 9 | trap 'on_error $LINENO' ERR 10 | 11 | if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then 12 | # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy 13 | # frameworks to, so exit 0 (signalling the script phase was successful). 14 | exit 0 15 | fi 16 | 17 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 18 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 19 | 20 | COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" 21 | SWIFT_STDLIB_PATH="${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 22 | BCSYMBOLMAP_DIR="BCSymbolMaps" 23 | 24 | 25 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 26 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 27 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 28 | 29 | # Copies and strips a vendored framework 30 | install_framework() 31 | { 32 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 33 | local source="${BUILT_PRODUCTS_DIR}/$1" 34 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 35 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 36 | elif [ -r "$1" ]; then 37 | local source="$1" 38 | fi 39 | 40 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 41 | 42 | if [ -L "${source}" ]; then 43 | echo "Symlinked..." 44 | source="$(readlink -f "${source}")" 45 | fi 46 | 47 | if [ -d "${source}/${BCSYMBOLMAP_DIR}" ]; then 48 | # Locate and install any .bcsymbolmaps if present, and remove them from the .framework before the framework is copied 49 | find "${source}/${BCSYMBOLMAP_DIR}" -name "*.bcsymbolmap"|while read f; do 50 | echo "Installing $f" 51 | install_bcsymbolmap "$f" "$destination" 52 | rm "$f" 53 | done 54 | rmdir "${source}/${BCSYMBOLMAP_DIR}" 55 | fi 56 | 57 | # Use filter instead of exclude so missing patterns don't throw errors. 58 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 59 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 60 | 61 | local basename 62 | basename="$(basename -s .framework "$1")" 63 | binary="${destination}/${basename}.framework/${basename}" 64 | 65 | if ! [ -r "$binary" ]; then 66 | binary="${destination}/${basename}" 67 | elif [ -L "${binary}" ]; then 68 | echo "Destination binary is symlinked..." 69 | dirname="$(dirname "${binary}")" 70 | binary="${dirname}/$(readlink "${binary}")" 71 | fi 72 | 73 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 74 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 75 | strip_invalid_archs "$binary" 76 | fi 77 | 78 | # Resign the code if required by the build settings to avoid unstable apps 79 | code_sign_if_enabled "${destination}/$(basename "$1")" 80 | 81 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 82 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 83 | local swift_runtime_libs 84 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u) 85 | for lib in $swift_runtime_libs; do 86 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 87 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 88 | code_sign_if_enabled "${destination}/${lib}" 89 | done 90 | fi 91 | } 92 | # Copies and strips a vendored dSYM 93 | install_dsym() { 94 | local source="$1" 95 | warn_missing_arch=${2:-true} 96 | if [ -r "$source" ]; then 97 | # Copy the dSYM into the targets temp dir. 98 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" 99 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" 100 | 101 | local basename 102 | basename="$(basename -s .dSYM "$source")" 103 | binary_name="$(ls "$source/Contents/Resources/DWARF")" 104 | binary="${DERIVED_FILES_DIR}/${basename}.dSYM/Contents/Resources/DWARF/${binary_name}" 105 | 106 | # Strip invalid architectures from the dSYM. 107 | if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then 108 | strip_invalid_archs "$binary" "$warn_missing_arch" 109 | fi 110 | if [[ $STRIP_BINARY_RETVAL == 0 ]]; then 111 | # Move the stripped file into its final destination. 112 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" 113 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.dSYM" "${DWARF_DSYM_FOLDER_PATH}" 114 | else 115 | # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. 116 | mkdir -p "${DWARF_DSYM_FOLDER_PATH}" 117 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.dSYM" 118 | fi 119 | fi 120 | } 121 | 122 | # Used as a return value for each invocation of `strip_invalid_archs` function. 123 | STRIP_BINARY_RETVAL=0 124 | 125 | # Strip invalid architectures 126 | strip_invalid_archs() { 127 | binary="$1" 128 | warn_missing_arch=${2:-true} 129 | # Get architectures for current target binary 130 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" 131 | # Intersect them with the architectures we are building for 132 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" 133 | # If there are no archs supported by this binary then warn the user 134 | if [[ -z "$intersected_archs" ]]; then 135 | if [[ "$warn_missing_arch" == "true" ]]; then 136 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." 137 | fi 138 | STRIP_BINARY_RETVAL=1 139 | return 140 | fi 141 | stripped="" 142 | for arch in $binary_archs; do 143 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 144 | # Strip non-valid architectures in-place 145 | lipo -remove "$arch" -output "$binary" "$binary" 146 | stripped="$stripped $arch" 147 | fi 148 | done 149 | if [[ "$stripped" ]]; then 150 | echo "Stripped $binary of architectures:$stripped" 151 | fi 152 | STRIP_BINARY_RETVAL=0 153 | } 154 | 155 | # Copies the bcsymbolmap files of a vendored framework 156 | install_bcsymbolmap() { 157 | local bcsymbolmap_path="$1" 158 | local destination="${BUILT_PRODUCTS_DIR}" 159 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"" 160 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}" 161 | } 162 | 163 | # Signs a framework with the provided identity 164 | code_sign_if_enabled() { 165 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 166 | # Use the current code_sign_identity 167 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 168 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" 169 | 170 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 171 | code_sign_cmd="$code_sign_cmd &" 172 | fi 173 | echo "$code_sign_cmd" 174 | eval "$code_sign_cmd" 175 | fi 176 | } 177 | 178 | if [[ "$CONFIGURATION" == "Debug" ]]; then 179 | install_framework "${BUILT_PRODUCTS_DIR}/Connectivity-macOS/Connectivity.framework" 180 | fi 181 | if [[ "$CONFIGURATION" == "Release" ]]; then 182 | install_framework "${BUILT_PRODUCTS_DIR}/Connectivity-macOS/Connectivity.framework" 183 | fi 184 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 185 | wait 186 | fi 187 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Example_macOS/Pods-Connectivity_Example_macOS-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_Connectivity_Example_macOSVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_Connectivity_Example_macOSVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Example_macOS/Pods-Connectivity_Example_macOS.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Connectivity-macOS" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Connectivity-macOS/Connectivity.framework/Headers" 6 | LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift '@executable_path/../Frameworks' '@loader_path/Frameworks' "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 7 | LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift 8 | OTHER_LDFLAGS = $(inherited) -framework "Connectivity" -framework "SystemConfiguration" -weak_framework "Combine" -weak_framework "Network" 9 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 10 | PODS_BUILD_DIR = ${BUILD_DIR} 11 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 12 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 13 | PODS_ROOT = ${SRCROOT}/Pods 14 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 15 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 16 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Example_macOS/Pods-Connectivity_Example_macOS.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_Connectivity_Example_macOS { 2 | umbrella header "Pods-Connectivity_Example_macOS-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Example_macOS/Pods-Connectivity_Example_macOS.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Connectivity-macOS" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Connectivity-macOS/Connectivity.framework/Headers" 6 | LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift '@executable_path/../Frameworks' '@loader_path/Frameworks' "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 7 | LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift 8 | OTHER_LDFLAGS = $(inherited) -framework "Connectivity" -framework "SystemConfiguration" -weak_framework "Combine" -weak_framework "Network" 9 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 10 | PODS_BUILD_DIR = ${BUILD_DIR} 11 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 12 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 13 | PODS_ROOT = ${SRCROOT}/Pods 14 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 15 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 16 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Tests/Pods-Connectivity_Tests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | ${PODS_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 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Tests/Pods-Connectivity_Tests-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## OHHTTPStubs 5 | 6 | - MIT LICENSE - 7 | 8 | Copyright (c) 2012 Olivier Halligon 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | Generated by CocoaPods - https://cocoapods.org 16 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Tests/Pods-Connectivity_Tests-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | - MIT LICENSE - 18 | 19 | Copyright (c) 2012 Olivier Halligon 20 | 21 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | License 27 | MIT 28 | Title 29 | OHHTTPStubs 30 | Type 31 | PSGroupSpecifier 32 | 33 | 34 | FooterText 35 | Generated by CocoaPods - https://cocoapods.org 36 | Title 37 | 38 | Type 39 | PSGroupSpecifier 40 | 41 | 42 | StringsTable 43 | Acknowledgements 44 | Title 45 | Acknowledgements 46 | 47 | 48 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Tests/Pods-Connectivity_Tests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_Connectivity_Tests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_Connectivity_Tests 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Tests/Pods-Connectivity_Tests-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | function on_error { 7 | echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" 8 | } 9 | trap 'on_error $LINENO' ERR 10 | 11 | if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then 12 | # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy 13 | # frameworks to, so exit 0 (signalling the script phase was successful). 14 | exit 0 15 | fi 16 | 17 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 18 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 19 | 20 | COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" 21 | SWIFT_STDLIB_PATH="${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 22 | BCSYMBOLMAP_DIR="BCSymbolMaps" 23 | 24 | 25 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 26 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 27 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 28 | 29 | # Copies and strips a vendored framework 30 | install_framework() 31 | { 32 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 33 | local source="${BUILT_PRODUCTS_DIR}/$1" 34 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 35 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 36 | elif [ -r "$1" ]; then 37 | local source="$1" 38 | fi 39 | 40 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 41 | 42 | if [ -L "${source}" ]; then 43 | echo "Symlinked..." 44 | source="$(readlink -f "${source}")" 45 | fi 46 | 47 | if [ -d "${source}/${BCSYMBOLMAP_DIR}" ]; then 48 | # Locate and install any .bcsymbolmaps if present, and remove them from the .framework before the framework is copied 49 | find "${source}/${BCSYMBOLMAP_DIR}" -name "*.bcsymbolmap"|while read f; do 50 | echo "Installing $f" 51 | install_bcsymbolmap "$f" "$destination" 52 | rm "$f" 53 | done 54 | rmdir "${source}/${BCSYMBOLMAP_DIR}" 55 | fi 56 | 57 | # Use filter instead of exclude so missing patterns don't throw errors. 58 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 59 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 60 | 61 | local basename 62 | basename="$(basename -s .framework "$1")" 63 | binary="${destination}/${basename}.framework/${basename}" 64 | 65 | if ! [ -r "$binary" ]; then 66 | binary="${destination}/${basename}" 67 | elif [ -L "${binary}" ]; then 68 | echo "Destination binary is symlinked..." 69 | dirname="$(dirname "${binary}")" 70 | binary="${dirname}/$(readlink "${binary}")" 71 | fi 72 | 73 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 74 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 75 | strip_invalid_archs "$binary" 76 | fi 77 | 78 | # Resign the code if required by the build settings to avoid unstable apps 79 | code_sign_if_enabled "${destination}/$(basename "$1")" 80 | 81 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 82 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 83 | local swift_runtime_libs 84 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u) 85 | for lib in $swift_runtime_libs; do 86 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 87 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 88 | code_sign_if_enabled "${destination}/${lib}" 89 | done 90 | fi 91 | } 92 | # Copies and strips a vendored dSYM 93 | install_dsym() { 94 | local source="$1" 95 | warn_missing_arch=${2:-true} 96 | if [ -r "$source" ]; then 97 | # Copy the dSYM into the targets temp dir. 98 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" 99 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" 100 | 101 | local basename 102 | basename="$(basename -s .dSYM "$source")" 103 | binary_name="$(ls "$source/Contents/Resources/DWARF")" 104 | binary="${DERIVED_FILES_DIR}/${basename}.dSYM/Contents/Resources/DWARF/${binary_name}" 105 | 106 | # Strip invalid architectures from the dSYM. 107 | if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then 108 | strip_invalid_archs "$binary" "$warn_missing_arch" 109 | fi 110 | if [[ $STRIP_BINARY_RETVAL == 0 ]]; then 111 | # Move the stripped file into its final destination. 112 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" 113 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.dSYM" "${DWARF_DSYM_FOLDER_PATH}" 114 | else 115 | # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. 116 | mkdir -p "${DWARF_DSYM_FOLDER_PATH}" 117 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.dSYM" 118 | fi 119 | fi 120 | } 121 | 122 | # Used as a return value for each invocation of `strip_invalid_archs` function. 123 | STRIP_BINARY_RETVAL=0 124 | 125 | # Strip invalid architectures 126 | strip_invalid_archs() { 127 | binary="$1" 128 | warn_missing_arch=${2:-true} 129 | # Get architectures for current target binary 130 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" 131 | # Intersect them with the architectures we are building for 132 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" 133 | # If there are no archs supported by this binary then warn the user 134 | if [[ -z "$intersected_archs" ]]; then 135 | if [[ "$warn_missing_arch" == "true" ]]; then 136 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." 137 | fi 138 | STRIP_BINARY_RETVAL=1 139 | return 140 | fi 141 | stripped="" 142 | for arch in $binary_archs; do 143 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 144 | # Strip non-valid architectures in-place 145 | lipo -remove "$arch" -output "$binary" "$binary" 146 | stripped="$stripped $arch" 147 | fi 148 | done 149 | if [[ "$stripped" ]]; then 150 | echo "Stripped $binary of architectures:$stripped" 151 | fi 152 | STRIP_BINARY_RETVAL=0 153 | } 154 | 155 | # Copies the bcsymbolmap files of a vendored framework 156 | install_bcsymbolmap() { 157 | local bcsymbolmap_path="$1" 158 | local destination="${BUILT_PRODUCTS_DIR}" 159 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"" 160 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}" 161 | } 162 | 163 | # Signs a framework with the provided identity 164 | code_sign_if_enabled() { 165 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 166 | # Use the current code_sign_identity 167 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 168 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" 169 | 170 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 171 | code_sign_cmd="$code_sign_cmd &" 172 | fi 173 | echo "$code_sign_cmd" 174 | eval "$code_sign_cmd" 175 | fi 176 | } 177 | 178 | if [[ "$CONFIGURATION" == "Debug" ]]; then 179 | install_framework "${BUILT_PRODUCTS_DIR}/OHHTTPStubs/OHHTTPStubs.framework" 180 | fi 181 | if [[ "$CONFIGURATION" == "Release" ]]; then 182 | install_framework "${BUILT_PRODUCTS_DIR}/OHHTTPStubs/OHHTTPStubs.framework" 183 | fi 184 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 185 | wait 186 | fi 187 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Tests/Pods-Connectivity_Tests-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_Connectivity_TestsVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_Connectivity_TestsVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Tests/Pods-Connectivity_Tests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Connectivity-iOS" "${PODS_CONFIGURATION_BUILD_DIR}/OHHTTPStubs" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Connectivity-iOS/Connectivity.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/OHHTTPStubs/OHHTTPStubs.framework/Headers" 6 | LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift "$(PLATFORM_DIR)/Developer/Library/Frameworks" '@executable_path/Frameworks' '@loader_path/Frameworks' 7 | LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift 8 | OTHER_LDFLAGS = $(inherited) -framework "CFNetwork" -framework "Connectivity" -framework "Foundation" -framework "OHHTTPStubs" -framework "SystemConfiguration" -weak_framework "Combine" -weak_framework "Network" 9 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 10 | PODS_BUILD_DIR = ${BUILD_DIR} 11 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 12 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 13 | PODS_ROOT = ${SRCROOT}/Pods 14 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 15 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 16 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Tests/Pods-Connectivity_Tests.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_Connectivity_Tests { 2 | umbrella header "Pods-Connectivity_Tests-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Connectivity_Tests/Pods-Connectivity_Tests.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Connectivity-iOS" "${PODS_CONFIGURATION_BUILD_DIR}/OHHTTPStubs" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Connectivity-iOS/Connectivity.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/OHHTTPStubs/OHHTTPStubs.framework/Headers" 6 | LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift "$(PLATFORM_DIR)/Developer/Library/Frameworks" '@executable_path/Frameworks' '@loader_path/Frameworks' 7 | LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift 8 | OTHER_LDFLAGS = $(inherited) -framework "CFNetwork" -framework "Connectivity" -framework "Foundation" -framework "OHHTTPStubs" -framework "SystemConfiguration" -weak_framework "Combine" -weak_framework "Network" 9 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 10 | PODS_BUILD_DIR = ${BUILD_DIR} 11 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 12 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 13 | PODS_ROOT = ${SRCROOT}/Pods 14 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 15 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 16 | -------------------------------------------------------------------------------- /Example/Tests/BackgroundingTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BackgroundingTests.swift 3 | // Connectivity 4 | // 5 | // Created by Ross Butler on 15/09/2020. 6 | // Copyright © 2020 Ross Butler. All rights reserved. 7 | // 8 | 9 | @testable import Connectivity 10 | import OHHTTPStubs 11 | import UIKit 12 | import XCTest 13 | 14 | class BackgroundingTests: XCTestCase { 15 | private let timeout: TimeInterval = 5.0 16 | 17 | func testConnectivityCheckOnApplicationDidBecomeActive() { 18 | stubHost("www.apple.com", withHTMLFrom: "success-response.html") 19 | let connectivity = Connectivity() 20 | connectivity.checkWhenApplicationDidBecomeActive = true 21 | connectivity.framework = .systemConfiguration 22 | connectivity.startNotifier() 23 | 24 | // First notification will be posted on invocation of `startNotifier`. 25 | let connectedNotificationExpectation = expectation( 26 | forNotification: Notification.Name.ConnectivityDidChange, 27 | object: connectivity, 28 | handler: nil 29 | ) 30 | wait(for: [connectedNotificationExpectation], timeout: timeout) 31 | 32 | // In order for another notification to be posted the connectivity status will need to change. 33 | stubHost("captive.apple.com", withHTMLFrom: "failure-response.html") 34 | stubHost("www.apple.com", withHTMLFrom: "failure-response.html") 35 | 36 | // Posting `UIApplication.didBecomeActiveNotification` will trigger another check. 37 | NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) 38 | let disconnectedNotificationExpectation = expectation( 39 | forNotification: Notification.Name.ConnectivityDidChange, 40 | object: connectivity, 41 | handler: nil 42 | ) 43 | wait(for: [disconnectedNotificationExpectation], timeout: timeout) 44 | connectivity.stopNotifier() 45 | } 46 | 47 | func testConnectivityDoesNotCheckOnApplicationDidBecomeActive() { 48 | stubHost("www.apple.com", withHTMLFrom: "success-response.html") 49 | let connectivity = Connectivity() 50 | connectivity.checkWhenApplicationDidBecomeActive = false 51 | connectivity.framework = .systemConfiguration 52 | connectivity.startNotifier() 53 | 54 | // First notification will be posted on invocation of `startNotifier`. 55 | let connectedNotificationExpectation = expectation( 56 | forNotification: Notification.Name.ConnectivityDidChange, 57 | object: connectivity, 58 | handler: nil 59 | ) 60 | wait(for: [connectedNotificationExpectation], timeout: timeout) 61 | 62 | // In order for another notification to be posted the connectivity status will need to change. 63 | stubHost("captive.apple.com", withHTMLFrom: "failure-response.html") 64 | stubHost("www.apple.com", withHTMLFrom: "failure-response.html") 65 | 66 | // Posting `UIApplication.didBecomeActiveNotification` will trigger another check. 67 | NotificationCenter.default.post(name: UIApplication.didBecomeActiveNotification, object: nil) 68 | let disconnectedNotificationExpectation = expectation( 69 | forNotification: Notification.Name.ConnectivityDidChange, 70 | object: connectivity, 71 | handler: nil 72 | ) 73 | disconnectedNotificationExpectation.isInverted = true 74 | wait(for: [disconnectedNotificationExpectation], timeout: timeout / 2) 75 | connectivity.stopNotifier() 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Example/Tests/ConnectivityPercentageTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectivityPercentageTests.swift 3 | // Connectivity 4 | // 5 | // Created by Ross Butler on 10/05/2020. 6 | // Copyright © 2020 Ross Butler. All rights reserved. 7 | // 8 | 9 | @testable import Connectivity 10 | import XCTest 11 | 12 | class ConnectivityPercentageTests: XCTestCase { 13 | func testMidRangeValueApplied() { 14 | let sut = ConnectivityPercentage(50.0) 15 | XCTAssertEqual(sut.value, 50.0) 16 | } 17 | 18 | func testLowerBoundaryValueApplied() { 19 | let sut = ConnectivityPercentage(0.0) 20 | XCTAssertEqual(sut.value, 0.0) 21 | } 22 | 23 | func testUpperBoundaryValueApplied() { 24 | let sut = ConnectivityPercentage(100.0) 25 | XCTAssertEqual(sut.value, 100.0) 26 | } 27 | 28 | func testOutOfLowerBoundValueNotApplied() { 29 | let sut = ConnectivityPercentage(-0.1) 30 | XCTAssertEqual(sut.value, 0.0) 31 | } 32 | 33 | func testOutOfUpperBoundValueNotApplied() { 34 | let sut = ConnectivityPercentage(100.1) 35 | XCTAssertEqual(sut.value, 100.0) 36 | } 37 | 38 | func testConnectivityPercentageCalculatedWithMidRangeUIntValues() { 39 | let sut = ConnectivityPercentage(UInt(2), outOf: UInt(10)) 40 | XCTAssertEqual(sut.value, 20.0) 41 | } 42 | 43 | func testConnectivityPercentageCalculatedWithLowerBoundaryUIntValues() { 44 | let sut = ConnectivityPercentage(UInt(0), outOf: UInt(1)) 45 | XCTAssertEqual(sut.value, 0.0) 46 | } 47 | 48 | func testConnectivityPercentageCalculatedIsZeroWhenDivisorIsZero() { 49 | let sut = ConnectivityPercentage(UInt(1), outOf: UInt(0)) 50 | XCTAssertEqual(sut.value, 0.0) 51 | } 52 | 53 | func testConnectivityPercentageNotLessThanSameValue() { 54 | XCTAssertFalse(ConnectivityPercentage(0.0) < ConnectivityPercentage(0.0)) 55 | } 56 | 57 | func testConnectivityPercentageIsLessThanGreaterValue() { 58 | XCTAssertTrue(ConnectivityPercentage(0.0) < ConnectivityPercentage(0.1)) 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Example/Tests/ConnectivityStatusTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectivityStatusTests.swift 3 | // Connectivity 4 | // 5 | // Created by Ross Butler on 10/05/2020. 6 | // Copyright © 2020 Ross Butler. All rights reserved. 7 | // 8 | 9 | @testable import Connectivity 10 | import XCTest 11 | 12 | class ConnectivityStatusTests: XCTestCase { 13 | func testDescriptionForConnectedIsCorrect() { 14 | let sut = ConnectivityStatus.connected 15 | XCTAssertEqual(sut.description, "Internet access") 16 | } 17 | 18 | func testDescriptionForCellularWithInternetIsCorrect() { 19 | let sut = ConnectivityStatus.connectedViaCellular 20 | XCTAssertEqual(sut.description, "Cellular with Internet access") 21 | } 22 | 23 | func testDescriptionForCellularWithoutInternetIsCorrect() { 24 | let sut = ConnectivityStatus.connectedViaCellularWithoutInternet 25 | XCTAssertEqual(sut.description, "Cellular without Internet access") 26 | } 27 | 28 | func testDescriptionForWiFiWithInternetIsCorrect() { 29 | let sut = ConnectivityStatus.connectedViaWiFi 30 | XCTAssertEqual(sut.description, "Wi-Fi with Internet access") 31 | } 32 | 33 | func testDescriptionForWiFiWithoutInternetIsCorrect() { 34 | let sut = ConnectivityStatus.connectedViaWiFiWithoutInternet 35 | XCTAssertEqual(sut.description, "Wi-Fi without Internet access") 36 | } 37 | 38 | func testDescriptionForDeterminingIsCorrect() { 39 | let sut = ConnectivityStatus.determining 40 | XCTAssertEqual(sut.description, "Connectivity checks pending") 41 | } 42 | 43 | func testDescriptionForNoConnectionIsCorrect() { 44 | let sut = ConnectivityStatus.notConnected 45 | XCTAssertEqual(sut.description, "No Connection") 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Example/Tests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/Tests/MockResponseValidator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MockResponseValidator.swift 3 | // Connectivity 4 | // 5 | // Created by Ross Butler on 14/05/2022. 6 | // Copyright © 2022 Ross Butler. All rights reserved. 7 | // 8 | 9 | @testable import Connectivity 10 | import Foundation 11 | 12 | class MockResponseValidator: ResponseValidator { 13 | private let isResponseValid: Bool 14 | private(set) var isResponseValidCalled = false 15 | private(set) var lastData: Data? 16 | private(set) var lastResponse: URLResponse? 17 | private(set) var lastURLRequest: URLRequest? 18 | 19 | init(isResponseValid: Bool = true) { 20 | self.isResponseValid = isResponseValid 21 | } 22 | 23 | func isResponseValid(urlRequest: URLRequest, response: URLResponse?, data: Data?) -> Bool { 24 | isResponseValidCalled = true 25 | lastData = data 26 | lastResponse = response 27 | lastURLRequest = urlRequest 28 | return isResponseValid 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Example/Tests/RegularExpressionResponseValidatorTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectivityResponseRegExValidatorTests.swift 3 | // Connectivity_Example 4 | // 5 | // Created by Ross Butler on 10/24/19. 6 | // Copyright © 2019 Ross Butler. All rights reserved. 7 | // 8 | 9 | @testable import Connectivity 10 | import Foundation 11 | import XCTest 12 | 13 | class RegularExpressionResponseValidatorTests: XCTestCase { 14 | func testRegexStringValidation() throws { 15 | try checkValid(string: "test1234", matchedBy: "test[0-9]+", expectedResult: true) 16 | try checkValid(string: "testa1234", matchedBy: "test[0-9]+", expectedResult: false) 17 | } 18 | 19 | private func checkValid( 20 | string: String, 21 | matchedBy regEx: String, 22 | expectedResult: Bool, 23 | file: StaticString = #filePath, 24 | line: UInt = #line 25 | ) throws { 26 | let data = string.data(using: .utf8) 27 | let url = try XCTUnwrap(URL(string: "https://example.com")) 28 | let urlRequest = URLRequest(url: url) 29 | let validator = ConnectivityResponseRegExValidator(regEx: regEx) 30 | let result = validator.isResponseValid(urlRequest: urlRequest, response: nil, data: data) 31 | let expectedResultStr = expectedResult ? "match" : "not match" 32 | let message = "Expected \"\(string)\" to \(expectedResultStr) \(regEx) via regex" 33 | XCTAssertEqual(result, expectedResult, message, file: file, line: line) 34 | } 35 | 36 | func testResponseInvalidWhenDataIsNil() throws { 37 | let regEx = "test[0-9]+" 38 | let url = try XCTUnwrap(URL(string: "https://example.com")) 39 | let urlRequest = URLRequest(url: url) 40 | let validator = ConnectivityResponseRegExValidator(regEx: regEx) 41 | let responseValid = validator.isResponseValid(urlRequest: urlRequest, response: nil, data: nil) 42 | XCTAssertFalse(responseValid) 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Example/Tests/ResponseValidatorFactoryTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ResponseValidatorFactoryTests.swift 3 | // Connectivity_Tests 4 | // 5 | // Created by Ross Butler on 25/10/2019. 6 | // Copyright © 2019 CocoaPods. All rights reserved. 7 | // 8 | 9 | @testable import Connectivity 10 | import Foundation 11 | import XCTest 12 | 13 | class ResponseValidatorFactoryTests: XCTestCase { 14 | /// Test correct validator is returned for validation mode `.equalsExpectedResponseString`. 15 | func testEqualsExpectedResponseString() { 16 | let responseValidator = ConnectivityResponseContainsStringValidator() 17 | let factory = ResponseValidatorFactory( 18 | validationMode: .equalsExpectedResponseString, 19 | expectedResponse: "expected", 20 | regEx: "", 21 | customValidator: responseValidator 22 | ) 23 | let validator = factory.manufacture() 24 | XCTAssert(validator is ConnectivityResponseStringEqualityValidator) 25 | } 26 | 27 | /// Test correct validator is returned for validation mode `.containsExpectedResponseString`. 28 | func testContainsExpectedResponseString() { 29 | let responseValidator = ConnectivityResponseContainsStringValidator() 30 | let factory = ResponseValidatorFactory( 31 | validationMode: .containsExpectedResponseString, 32 | expectedResponse: "expected", 33 | regEx: "", 34 | customValidator: responseValidator 35 | ) 36 | let validator = factory.manufacture() 37 | XCTAssert(validator is ConnectivityResponseContainsStringValidator) 38 | } 39 | 40 | /// Test correct validator is returned for validation mode `.matchesRegularExpression`. 41 | func testMatchesRegularExpression() { 42 | let responseValidator = ConnectivityResponseContainsStringValidator() 43 | let factory = ResponseValidatorFactory( 44 | validationMode: .matchesRegularExpression, 45 | expectedResponse: "expected", 46 | regEx: "", 47 | customValidator: responseValidator 48 | ) 49 | let validator = factory.manufacture() 50 | XCTAssert(validator is ConnectivityResponseRegExValidator) 51 | } 52 | 53 | /// Test correct validator is returned for validation mode `.custom`. 54 | func testCustomValidatorReturnedForCustomValidationMode() { 55 | let responseValidator = ConnectivityResponseRegExValidator() 56 | let factory = ResponseValidatorFactory( 57 | validationMode: .custom, 58 | expectedResponse: "expected", 59 | regEx: "", 60 | customValidator: responseValidator 61 | ) 62 | let validator = factory.manufacture() 63 | XCTAssert(validator === responseValidator) 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Example/Tests/StringEqualityResponseValidatorTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // StringEqualityResponseValidatorTests.swift 3 | // Connectivity 4 | // 5 | // Created by Ross Butler on 10/28/19. 6 | // Copyright © 2019 Ross Butler. All rights reserved. 7 | // 8 | 9 | @testable import Connectivity 10 | import Foundation 11 | import OHHTTPStubs 12 | import XCTest 13 | 14 | class StringEqualityResponseValidatorTests: XCTestCase { 15 | private let timeout: TimeInterval = 5.0 16 | 17 | override func tearDown() { 18 | super.tearDown() 19 | HTTPStubs.removeAllStubs() 20 | } 21 | 22 | /// Test response is valid when the response string is equal to the expected response. 23 | func testEqualsExpectedResponseString() { 24 | stubHost("www.apple.com", withHTMLFrom: "string-equality-response.html") 25 | let expectation = XCTestExpectation(description: "Connectivity check succeeds") 26 | let connectivity = Connectivity() 27 | connectivity.responseValidator = ConnectivityResponseStringEqualityValidator(expectedResponse: "Success") 28 | connectivity.validationMode = .custom 29 | let connectivityChanged: (Connectivity) -> Void = { connectivity in 30 | XCTAssert(connectivity.status == .connectedViaWiFi) 31 | expectation.fulfill() 32 | } 33 | connectivity.whenConnected = connectivityChanged 34 | connectivity.whenDisconnected = connectivityChanged 35 | connectivity.startNotifier() 36 | wait(for: [expectation], timeout: timeout) 37 | connectivity.stopNotifier() 38 | } 39 | 40 | /// Test response is invalid when the response string is not equal to the expected response. 41 | func testNotEqualsExpectedResponseString() { 42 | stubHost("www.apple.com", withHTMLFrom: "string-contains-response.html") 43 | let expectation = XCTestExpectation(description: "Connectivity check fails") 44 | let connectivity = Connectivity() 45 | connectivity.responseValidator = ConnectivityResponseStringEqualityValidator(expectedResponse: "Success") 46 | connectivity.validationMode = .custom 47 | let connectivityChanged: (Connectivity) -> Void = { connectivity in 48 | XCTAssert(connectivity.status == .connectedViaWiFiWithoutInternet) 49 | expectation.fulfill() 50 | } 51 | connectivity.whenConnected = connectivityChanged 52 | connectivity.whenDisconnected = connectivityChanged 53 | connectivity.startNotifier() 54 | wait(for: [expectation], timeout: timeout) 55 | connectivity.stopNotifier() 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Example/Tests/failure-response.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
5 | 6 | 7 | 8 | 9 | 10 | 13 |
14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Example/Tests/string-contains-response.html: -------------------------------------------------------------------------------- 1 | 2 | Successful 3 | 4 | 5 | -------------------------------------------------------------------------------- /Example/Tests/string-equality-response.html: -------------------------------------------------------------------------------- 1 | Success 2 | -------------------------------------------------------------------------------- /Example/Tests/success-response.html: -------------------------------------------------------------------------------- 1 | 2 | Success 3 | 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 - 2018 Ross Butler 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.10 2 | import PackageDescription 3 | 4 | let package = Package( 5 | name: "Connectivity", 6 | platforms: [ 7 | .iOS(.v12), 8 | .tvOS(.v12), 9 | .macOS(.v10_13) 10 | ], 11 | products: [ 12 | .library( 13 | name: "Connectivity", 14 | targets: ["Connectivity"] 15 | ) 16 | ], 17 | targets: [ 18 | .target( 19 | name: "Connectivity", 20 | dependencies: ["Reachability"], 21 | path: "Connectivity/Classes", 22 | exclude: ["Reachability"], 23 | swiftSettings: [.define("IMPORT_REACHABILITY")] 24 | ), 25 | .target( 26 | name: "Reachability", 27 | dependencies: [], 28 | path: "Connectivity/Classes/Reachability", 29 | publicHeadersPath: "", 30 | cSettings: [ 31 | .headerSearchPath("Connectivity/Classes/Reachability") 32 | ] 33 | ) 34 | ] 35 | ) 36 | -------------------------------------------------------------------------------- /_Pods.xcodeproj: -------------------------------------------------------------------------------- 1 | Example/Pods/Pods.xcodeproj -------------------------------------------------------------------------------- /docs/images/add-package.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rwbutler/Connectivity/30956aa751170afee0feb340714829dff159b265/docs/images/add-package.png -------------------------------------------------------------------------------- /docs/images/connectivity-banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rwbutler/Connectivity/30956aa751170afee0feb340714829dff159b265/docs/images/connectivity-banner.png -------------------------------------------------------------------------------- /docs/images/connectivity-large-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rwbutler/Connectivity/30956aa751170afee0feb340714829dff159b265/docs/images/connectivity-large-logo.png -------------------------------------------------------------------------------- /docs/images/connectivity-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rwbutler/Connectivity/30956aa751170afee0feb340714829dff159b265/docs/images/connectivity-logo.png -------------------------------------------------------------------------------- /docs/images/package-options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rwbutler/Connectivity/30956aa751170afee0feb340714829dff159b265/docs/images/package-options.png -------------------------------------------------------------------------------- /docs/presentations/connectivity.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rwbutler/Connectivity/30956aa751170afee0feb340714829dff159b265/docs/presentations/connectivity.pdf -------------------------------------------------------------------------------- /tools/linting/Package.resolved: -------------------------------------------------------------------------------- 1 | { 2 | "object": { 3 | "pins": [ 4 | { 5 | "package": "SwiftFormat", 6 | "repositoryURL": "https://github.com/nicklockwood/SwiftFormat.git", 7 | "state": { 8 | "branch": null, 9 | "revision": "2dcce7fe2d6c245d8d669d394d5be5fe45d582fc", 10 | "version": "0.49.8" 11 | } 12 | } 13 | ] 14 | }, 15 | "version": 1 16 | } 17 | -------------------------------------------------------------------------------- /tools/linting/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.1 2 | import PackageDescription 3 | 4 | let package = Package( 5 | name: "linting", 6 | platforms: [.macOS(.v10_11)], 7 | dependencies: [ 8 | .package(url: "https://github.com/nicklockwood/SwiftFormat.git", from: "0.48.10"), 9 | ], 10 | targets: [.target(name: "linting", path: "")] 11 | ) 12 | --------------------------------------------------------------------------------