Skip to content

Commit 7d6789e

Browse files
committed
Update for Swift 2.2
1 parent 9460aee commit 7d6789e

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

Example/ViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ class ViewController: UIViewController, StatefulViewController {
1818
super.viewDidLoad()
1919

2020
// Setup refresh control
21-
refreshControl.addTarget(self, action: Selector("refresh"), forControlEvents: .ValueChanged)
21+
refreshControl.addTarget(self, action: #selector(refresh), forControlEvents: .ValueChanged)
2222
tableView.addSubview(refreshControl)
2323

2424
// Setup placeholder views
2525
loadingView = LoadingView(frame: view.frame)
2626
emptyView = EmptyView(frame: view.frame)
2727
let failureView = ErrorView(frame: view.frame)
28-
failureView.tapGestureRecognizer.addTarget(self, action: Selector("refresh"))
28+
failureView.tapGestureRecognizer.addTarget(self, action: #selector(refresh))
2929
errorView = failureView
3030
}
3131

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Build Status](https://travis-ci.org/aschuch/StatefulViewController.svg)](https://travis-ci.org/aschuch/StatefulViewController)
44
![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)
5-
![Swift 2](https://img.shields.io/badge/Swift-2-orange.svg)
5+
![Swift 2.2](https://img.shields.io/badge/Swift-2.2-orange.svg)
66

77
A protocol to enable `UIViewController`s or `UIView`s to present placeholder views based on content, loading, error or empty states.
88

@@ -26,18 +26,18 @@ As trivial as this flow may sound, there are a lot of cases that result in a rat
2626
2727
First, make sure your view controller adopts to the `StatefulViewController` protocol.
2828

29-
```swift
29+
```swift
3030
class MyViewController: UIViewController, StatefulViewController {
3131
// ...
3232
}
33-
```
33+
```
3434

3535
Then, configure the `loadingView`, `emptyView` and `errorView` properties (provided by the `StatefulViewController` protocol) in `viewDidLoad`.
3636

3737
```swift
3838
override func viewDidLoad() {
3939
super.viewDidLoad()
40-
40+
4141
// Setup placeholder views
4242
loadingView = // UIView
4343
emptyView = // UIView
@@ -50,7 +50,7 @@ In addition, call the `setupInitialViewState()` method in `viewWillAppear:` in o
5050
```swift
5151
override func viewWillAppear(animated: Bool) {
5252
super.viewWillAppear(animated)
53-
53+
5454
setupInitialViewState()
5555
}
5656
```
@@ -60,7 +60,7 @@ After that, simply tell the view controller whenever content is loading and `Sta
6060
```swift
6161
override func viewWillAppear(animated: Bool) {
6262
super.viewWillAppear(animated)
63-
63+
6464
loadDeliciousWines()
6565
}
6666

@@ -180,4 +180,4 @@ xctool -scheme StatefulViewControllerTests -sdk iphonesimulator test
180180
Feel free to get in touch.
181181

182182
* Website: <http://schuch.me>
183-
* Twitter: [@schuchalexander](http://twitter.com/schuchalexander)
183+
* Twitter: [@schuchalexander](http://twitter.com/schuchalexander)

0 commit comments

Comments
 (0)