Skip to content
This repository was archived by the owner on Apr 19, 2023. It is now read-only.

Commit 1594ff7

Browse files
committed
update README
1 parent 687eb71 commit 1594ff7

1 file changed

Lines changed: 96 additions & 13 deletions

File tree

README.md

Lines changed: 96 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,112 @@
1-
# SafeAreaInputAccessoryViewWrapperView
1+
![SafeAreaInputAccessoryViewWrapperView Logo](https://user-images.githubusercontent.com/2835199/31246076-44e55554-a9da-11e7-9e71-da5fe0663220.png)
22

3-
[![CI Status](http://img.shields.io/travis/jeffaburt/SafeAreaInputAccessoryViewWrapperView.svg?style=flat)](https://travis-ci.org/jeffaburt/SafeAreaInputAccessoryViewWrapperView)
3+
![Swift4.0](https://img.shields.io/badge/Swift-4.0-orange.svg?style=flat")
4+
[![Platform](https://img.shields.io/cocoapods/p/SafeAreaInputAccessoryViewWrapperView.svg?style=flat)](http://cocoapods.org/pods/SafeAreaInputAccessoryViewWrapperView)
45
[![Version](https://img.shields.io/cocoapods/v/SafeAreaInputAccessoryViewWrapperView.svg?style=flat)](http://cocoapods.org/pods/SafeAreaInputAccessoryViewWrapperView)
56
[![License](https://img.shields.io/cocoapods/l/SafeAreaInputAccessoryViewWrapperView.svg?style=flat)](http://cocoapods.org/pods/SafeAreaInputAccessoryViewWrapperView)
6-
[![Platform](https://img.shields.io/cocoapods/p/SafeAreaInputAccessoryViewWrapperView.svg?style=flat)](http://cocoapods.org/pods/SafeAreaInputAccessoryViewWrapperView)
77

8-
## Example
8+
Description
9+
--------------
10+
11+
`SafeAreaInputAccessoryViewWrapperView` is useful for wrapping a view to be used as an `inputAccessoryView`. Without this, setting the view as an `inputAccessoryView` will ignore safe area layouts. For example, the Home screen indicator on iPhone X will battle for the same spot. This class ensures that the view respects safe area layouts and does not cover up system UI elements such as the Home screen indicator on iPhone X.
12+
13+
**Works with iOS 9.0+ and Xcode 9.0.0+.**
14+
15+
# Contents
16+
1. [Features](#features)
17+
2. [Usage](#usage)
18+
3. [Installation](#installation)
19+
6. [License](#license)
20+
7. [Contact](#contact)
21+
22+
<a name="features"> Features </a>
23+
--------------
24+
25+
- [x] Works with all devices running iOS 9+.
26+
- [x] Respects `safeAreaLayoutGuide` on devices running iOS 11+. For example, the wrapped view is slid up to make room for the iPhone X Home screen indicator.
27+
- [x] Dynamically sets the wrapped view's height using autolayout constraints. No more setting frames manually!
28+
- [x] Example app with an `inputAccessoryView` that's always visible, even when the keyboard is closed.
29+
30+
![Example Project Screenshot - iPhone X](https://user-images.githubusercontent.com/2835199/31238567-5c96c3f2-a9c8-11e7-86f5-170ebc372cdc.png)
31+
![Example Project Screenshot - iPhone 8](https://user-images.githubusercontent.com/2835199/31238568-5c99393e-a9c8-11e7-8458-2a2a21e3eded.png)
32+
33+
<a name="usage"> Usage </a>
34+
--------------
35+
36+
1. Wrap any UIView/UIButton/UILabel/etc using `SafeAreaInputAccessoryViewWrapperView(for:)`:
37+
38+
```swift
39+
SafeAreaInputAccessoryViewWrapperView(for: button)
40+
```
41+
42+
2. Store a reference to this somewhere in your class:
43+
44+
```swift
45+
let button = UIButton(type: .system)
46+
47+
lazy var wrappedButton: SafeAreaInputAccessoryViewWrapperView = {
48+
return SafeAreaInputAccessoryViewWrapperView(for: button)
49+
}()
50+
```
51+
52+
3. Return the reference in `inputAccessoryView`:
53+
54+
```swift
55+
override var inputAccessoryView: UIView? {
56+
return wrappedButton
57+
}
58+
```
59+
60+
4. (Optional) Always show the `inputAccessoryView`, even when the keyboard is closed:
61+
62+
```swift
63+
override var canBecomeFirstResponder: Bool {
64+
return true
65+
}
66+
67+
override func viewDidLoad() {
68+
super.viewDidLoad()
69+
becomeFirstResponder()
70+
}
71+
```
72+
73+
<a name="installation"> Installation </a>
74+
--------------
975

10-
To run the example project, clone the repo, and run `pod install` from the Example directory first.
76+
### CocoaPods
1177

12-
## Requirements
78+
[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects.
1379

14-
## Installation
80+
CocoaPods 0.36 adds supports for Swift and embedded frameworks. You can install it with the following command:
1581

16-
SafeAreaInputAccessoryViewWrapperView is available through [CocoaPods](http://cocoapods.org). To install
17-
it, simply add the following line to your Podfile:
82+
```bash
83+
$ gem install cocoapods
84+
```
85+
86+
To integrate `SafeAreaInputAccessoryViewWrapperView` into your Xcode project using CocoaPods, specify it in your `Podfile`:
1887

1988
```ruby
2089
pod 'SafeAreaInputAccessoryViewWrapperView'
2190
```
2291

23-
## Author
92+
Then, run the following command:
93+
94+
```bash
95+
$ pod install
96+
```
97+
98+
In case Xcode complains (<i>"Cannot load underlying module for SafeAreaInputAccessoryViewWrapperView"</i>) go to Product and choose Clean (or simply press <kbd>⇧</kbd><kbd>⌘</kbd><kbd>K</kbd>).
99+
100+
### Manually
101+
102+
If you prefer not to use CocoaPods, you can integrate `SafeAreaInputAccessoryViewWrapperView` into your project manually.
103+
104+
<a name="license"> License </a>
105+
--------------
24106

25-
jeffaburt, jburt1992@gmail.com
107+
`SafeAreaInputAccessoryViewWrapperView` is developed by [Jeff Burt](https://www.linkedin.com/in/jeffaburt) at [StockX](https://stockx.com) and is released under the MIT license. See the `LICENSE` file for details.
26108

27-
## License
109+
<a name="contact"> Contact </a>
110+
--------------
28111

29-
SafeAreaInputAccessoryViewWrapperView is available under the MIT license. See the LICENSE file for more info.
112+
Feel free to follow me on [my personal Twitter account](https://twitter.com/jeffburtjr). If you find any problems with the project or have ideas to enhance it, feel free to open a GitHub issue and/or create a pull request.

0 commit comments

Comments
 (0)