https://github.com/jean-melikian/silverplate-ios
A system event helper for iOS
https://github.com/jean-melikian/silverplate-ios
cocoa-framework ios swift-3 swift-framework system-event xcode8
Last synced: 8 months ago
JSON representation
A system event helper for iOS
- Host: GitHub
- URL: https://github.com/jean-melikian/silverplate-ios
- Owner: jean-melikian
- License: bsd-3-clause
- Created: 2017-01-25T15:52:51.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-20T19:22:23.000Z (over 9 years ago)
- Last Synced: 2025-08-23T06:40:56.360Z (about 1 year ago)
- Topics: cocoa-framework, ios, swift-3, swift-framework, system-event, xcode8
- Language: Swift
- Size: 157 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SilverPlate Framework [](https://travis-ci.org/SilverPlate-Framework/silverplate-ios)
___
## Description
__SilverPlate__ is a Swift3 framework which elegantly brings some of the most important system events to you.
Easy to use, you do not need protocols/delegates nor to implement a gazillion methods into your neat classes as the __SilverPlate__ public API relies on simple closures.
___
## Implementation
- In a ViewController or any other class, to respond to reachability status change:
```Swift3
import UIKit
import SilverPlate
class ViewController: UIViewController {
@IBOutlet weak var netStatusLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
SilverPlate.shared.onInternetStatusChanged = { (status) in
self.netStatusLabel.text = "Connectivity status: \(status)"
switch status {
case SilverPlate.Network.wifi:
// Do some heavy download
break
case SilverPlate.Network.cellular:
// Now easy with the data load
break
case SilverPlate.Network.none:
// Don't try to fetch anything from the web
break
}
}
}
}
```