I found a reachibility code online, unfortunately it only works for the wifi Network. I Need a code to determine if a person has an internet connection: this includes wifi and data. Any help is greatly appreciated!
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- SwiftUI: UIImage (QRCode) does not load after call
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- Using if let syntax in switch statement
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Enum with associated value conforming to CaseItera
- Swift - hide pickerView after value selected
- Is there a Github markdown language identifier for
You can use the Reachability framework. Install it through
CocoaPods
withpod 'ReachabilitySwift', '~> 3'
.To use it:
Declare a global variable:
Add an observer and start the notifier in your
viewWillAppear
:Add a function to detect changes in the network: