Swift Ruby Objective-C Shell
Permalink
Failed to load latest commit information.
Pods
SilverPlate.xcodeproj
SilverPlate.xcworkspace
SilverPlate
SilverPlateTests
fastlane
travis
.gitignore
.travis.yml
Gemfile
Gemfile.lock
LICENSE
Podfile
Podfile.lock
README.md
SilverPlate.podspec

README.md

SilverPlate Framework Build Status


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:
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
            }
        }
    }
}