Skip to content

Commit

Permalink
Update readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
npu3pak committed Jul 29, 2019
1 parent 5f74cf5 commit 518d71d
Showing 1 changed file with 79 additions and 2 deletions.
81 changes: 79 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

[Complete API reference](https://npu3pak.github.io/ios-lib-overlays/index.html)

Library for displaying an empty list message or a loading indicator. You can show any custom view atop of a view controller content.
A library for displaying an empty list message or a loading indicator. You can show any custom view atop of a view controller content.

![Overview image](https://raw.githubusercontent.com/npu3pak/ios-lib-overlays/master/Images/Overview.gif)

## Requirements
- iOS 9+
Expand All @@ -24,19 +26,94 @@ pod 'Overlays'

## Usage

### Prepare overlay view

Create a custom class for the overlay view. Implement the OverlayView protocol.

```swift
import Overlays

class CustomOverlay: UIView, OverlayView {
}
```

### Inside a View Controller

![Example image](https://raw.githubusercontent.com/npu3pak/ios-lib-overlays/master/Images/ViewController.gif)

```swift
import Overlays

class CustomOverlayViewController: UIViewController {
@IBOutlet var overlay: CustomOverlay!

func show() {
showOverlay(overlay)
}

func hide() {
hideOverlay()
}
```

### Atop of a View

![Example image](https://raw.githubusercontent.com/npu3pak/ios-lib-overlays/master/Images/ViewController.gif)

```swift
import Overlays
...
@IBOutlet var overlay: CustomOverlay!
@IBOutlet weak var containerView: UIView!

func show() {
containerView.showOverlay(overlay)
}

func hide() {
containerView.hideOverlay()
}
...
```

### Above the keyboard

![Example image](https://raw.githubusercontent.com/npu3pak/ios-lib-overlays/master/Images/AboveKeyboard.gif)

```swift
import Overlays

class CustomOverlayViewController: UIViewController {
@IBOutlet var overlay: CustomOverlay!

private lazy var keyboardAwareOverlays = KeyboardAwareOverlays(controller: self)

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
keyboardAwareOverlays.startListeningKeyboardEvents()
}

override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
keyboardAwareOverlays.stopListeningKeyboardEvents()
}

func show() {
keyboardAwareOverlays.showOverlay(overlay)
}

func hide() {
keyboardAwareOverlays.hideOverlay()
}
```

## Example

To run the example project, clone the repo, and run `pod install` from the Example directory first.

## Author

Evgeniy Safronov, [email protected]
Evgeniy Safronov, evsafronov.personal@yandex.ru, https://ios-dev.ru

## License

Expand Down

0 comments on commit 518d71d

Please sign in to comment.