Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: about 8 hours ago
JSON representation

A system event helper for iOS

Awesome Lists containing this project

README

        

# SilverPlate Framework [![Build Status](https://travis-ci.org/SilverPlate-Framework/silverplate-ios.svg?branch=master)](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
}
}
}
}
```