https://github.com/ioramashvili/radioaccesstechnologynotifier
https://github.com/ioramashvili/radioaccesstechnologynotifier
ios reachability swift
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/ioramashvili/radioaccesstechnologynotifier
- Owner: ioramashvili
- License: mit
- Created: 2017-09-07T12:28:02.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-09-07T17:28:29.000Z (almost 9 years ago)
- Last Synced: 2024-09-16T16:48:16.158Z (over 1 year ago)
- Topics: ios, reachability, swift
- Language: Swift
- Size: 16.6 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Detect if network is on Wifi, LTE, 3G or Edge
## Requirements
- iOS 9.0+
## Installation
### CocoaPods
[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:
```bash
$ gem install cocoapods
```
To integrate TableViewReloadAnimation into your Xcode project using CocoaPods, specify it in your `Podfile`:
```ruby
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
target '' do
pod 'RadioAccessTechnologyNotifier'
end
```
Then, run the following command:
```bash
$ pod install
```
## Usage
```swift
import RadioAccessTechnologyNotifier
```
in viewDidAppear
```swift
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// set delegate
RadioAccessTechnologyNotifier.shared.delegate = self
// get notification
NotificationCenter.default.addObserver(
self,
selector: #selector(radioAccessTechnologyNotifierStateDidChange),
name: RadioAccessTechnologyNotifierStateDidChange,
object: nil)
}
func radioAccessTechnologyNotifierStateDidChange() {
print(RadioAccessTechnologyNotifier.shared.currentState)
}
}
extension ViewController: RadioAccessTechnologyNotifierDelegate {
func didChange(to state: RadioAccessTechnologyNotifierState) {
print(state)
}
}
```