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
77A 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
2727First, make sure your view controller adopts to the ` StatefulViewController ` protocol.
2828
29- ``` swift
29+ ``` swift
3030class MyViewController : UIViewController , StatefulViewController {
3131 // ...
3232}
33- ```
33+ ```
3434
3535Then, configure the ` loadingView ` , ` emptyView ` and ` errorView ` properties (provided by the ` StatefulViewController ` protocol) in ` viewDidLoad ` .
3636
3737``` swift
3838override 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
5151override 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
6161override func viewWillAppear (animated : Bool ) {
6262 super .viewWillAppear (animated)
63-
63+
6464 loadDeliciousWines ()
6565}
6666
@@ -180,4 +180,4 @@ xctool -scheme StatefulViewControllerTests -sdk iphonesimulator test
180180Feel 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