<commit_before># KeyboardAdjuster

[![CI Status](http://img.shields.io/travis/<NAME>/KeyboardAdjuster.svg?style=flat)](https://travis-ci.org/<NAME>/KeyboardAdjuster)
[![Version](https://img.shields.io/cocoapods/v/KeyboardAdjuster.svg?style=flat)](http://cocoapods.org/pods/KeyboardAdjuster)
[![License](https://img.shields.io/cocoapods/l/KeyboardAdjuster.svg?style=flat)](http://cocoapods.org/pods/KeyboardAdjuster)
[![Platform](https://img.shields.io/cocoapods/p/KeyboardAdjuster.svg?style=flat)](http://cocoapods.org/pods/KeyboardAdjuster)

KeyboardAdjuster
----------------

KeyboardAdjuster will adjust the bottom position of any given `UIView` when a keyboard appears on screen. All you have to do is provide an NSLayoutConstraint that pins the bottom of your view to the bottom of the screen. KeyboardAdjuster will automatically adjust that constraint and pin it to the top of the keyboard when it appears.

Note: KeyboardAdjuster requires layout anchors in your build target, so it will only work with iOS 9 or above. If you'd like to add support for earlier iOS versions, please submit a pull request.

# History

KeyboardAdjuster is a Swift port of [LHSKeyboardAdjusting](https://github.com/lionheart/LHSKeyboardAdjusting), which targets projects written in Objective-C.

## Installation

KeyboardAdjuster is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod "KeyboardAdjuster"
```

### Usage

1. In your view controller file, import `KeyboardAdjusted` protocol.

   ```swift
   import KeyboardAdjusted
   ```

2. Make sure your `UIViewController` conforms to `KeyboardAdjusting`, and define two properties on it--`keyboardAdjustmentConstraint` and `keyboardAdjustmentAnimated` (a `Bool` to indicate whether the constraint adjustment should be animated).

   ```swift
   class MyViewController: UIViewController, KeyboardAdjusting {
       var keyboardAdjustmentConstraint: NSLayoutConstraint?
       var keyboardAdjustmentAnimated: Bool? = false
   }
   ```

2. Figure out which view you'd like to pin to the top of the keyboard. A `UIScrollView`, `UITableView`, or `UITextView` are likely candidates. Then, wherever you're setting up your view constraints, set the `keyboardAdjustmentConstraint` to the constraint pinning the bottom of this view to the bottom of the screen:

   ```swift
   func viewDidLoad() {
       super.viewDidLoad()

       // Your other setup code here...

       keyboardAdjustmentConstraint = view.bottomAnchor.constraintEqualToAnchor(scrollView.bottomAnchor)
   }
   ```

   KeyboardAdjuster will automatically activate `keyboardAdjustmentConstraint` for you.

3. All you need to do now is activate and deactivate the automatic adjustments in your `viewWillAppear(animated:)` and `viewWillDisappear(animated:)` methods.

   ```swift
   class MyViewController: UIViewController, KeyboardAdjusting {
       // ...

       override func viewWillAppear(animated: Bool) {
           super.viewWillAppear(animated)
           activateKeyboardAdjustment()
       }

       override func viewWillDisappear(animated: Bool) {
           super.viewWillDisappear(animated)
           deactivateKeyboardAdjustment()
       }
   }
   ```

4. And you're done! Whenever a keyboard appears, your views will be automatically resized.

## How It Works

KeyboardAdjuster registers NSNotificationCenter callbacks for keyboard appearance and disappearance. When a keyboard appears, it pulls out the keyboard size from the notification, along with the duration of the keyboard animation, and applies that to the view constraint adjustment.

## Author

[<NAME>](https://github.com/dlo)

## License

KeyboardAdjuster is available under the Apache 2.0 LICENSE. See the [LICENSE](LICENSE) file for more info.
<commit_msg>change header size<commit_after># KeyboardAdjuster

[![CI Status](http://img.shields.io/travis/Dan Loewenherz/KeyboardAdjuster.svg?style=flat)](https://travis-ci.org/<NAME>z/KeyboardAdjuster)
[![Version](https://img.shields.io/cocoapods/v/KeyboardAdjuster.svg?style=flat)](http://cocoapods.org/pods/KeyboardAdjuster)
[![License](https://img.shields.io/cocoapods/l/KeyboardAdjuster.svg?style=flat)](http://cocoapods.org/pods/KeyboardAdjuster)
[![Platform](https://img.shields.io/cocoapods/p/KeyboardAdjuster.svg?style=flat)](http://cocoapods.org/pods/KeyboardAdjuster)

KeyboardAdjuster
----------------

KeyboardAdjuster will adjust the bottom position of any given `UIView` when a keyboard appears on screen. All you have to do is provide an NSLayoutConstraint that pins the bottom of your view to the bottom of the screen. KeyboardAdjuster will automatically adjust that constraint and pin it to the top of the keyboard when it appears.

Note: KeyboardAdjuster requires layout anchors in your build target, so it will only work with iOS 9 or above. If you'd like to add support for earlier iOS versions, please submit a pull request.

## History

KeyboardAdjuster is a Swift port of [LHSKeyboardAdjusting](https://github.com/lionheart/LHSKeyboardAdjusting), which targets projects written in Objective-C.

## Installation

KeyboardAdjuster is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod "KeyboardAdjuster"
```

### Usage

1. In your view controller file, import `KeyboardAdjusted` protocol.

   ```swift
   import KeyboardAdjusted
   ```

2. Make sure your `UIViewController` conforms to `KeyboardAdjusting`, and define two properties on it--`keyboardAdjustmentConstraint` and `keyboardAdjustmentAnimated` (a `Bool` to indicate whether the constraint adjustment should be animated).

   ```swift
   class MyViewController: UIViewController, KeyboardAdjusting {
       var keyboardAdjustmentConstraint: NSLayoutConstraint?
       var keyboardAdjustmentAnimated: Bool? = false
   }
   ```

2. Figure out which view you'd like to pin to the top of the keyboard. A `UIScrollView`, `UITableView`, or `UITextView` are likely candidates. Then, wherever you're setting up your view constraints, set the `keyboardAdjustmentConstraint` to the constraint pinning the bottom of this view to the bottom of the screen:

   ```swift
   func viewDidLoad() {
       super.viewDidLoad()

       // Your other setup code here...

       keyboardAdjustmentConstraint = view.bottomAnchor.constraintEqualToAnchor(scrollView.bottomAnchor)
   }
   ```

   KeyboardAdjuster will automatically activate `keyboardAdjustmentConstraint` for you.

3. All you need to do now is activate and deactivate the automatic adjustments in your `viewWillAppear(animated:)` and `viewWillDisappear(animated:)` methods.

   ```swift
   class MyViewController: UIViewController, KeyboardAdjusting {
       // ...

       override func viewWillAppear(animated: Bool) {
           super.viewWillAppear(animated)
           activateKeyboardAdjustment()
       }

       override func viewWillDisappear(animated: Bool) {
           super.viewWillDisappear(animated)
           deactivateKeyboardAdjustment()
       }
   }
   ```

4. And you're done! Whenever a keyboard appears, your views will be automatically resized.

## How It Works

KeyboardAdjuster registers NSNotificationCenter callbacks for keyboard appearance and disappearance. When a keyboard appears, it pulls out the keyboard size from the notification, along with the duration of the keyboard animation, and applies that to the view constraint adjustment.

## Author

[<NAME>](https://github.com/dlo)

## License

KeyboardAdjuster is available under the Apache 2.0 LICENSE. See the [LICENSE](LICENSE) file for more info.

{'fraction_non_alphanumeric': 0.09076620825147348, 'fraction_numerical': 0.0020956123117223313, 'mean_word_length': 4.407932011331445, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4341747', 'n_tokens_mistral': 2171, 'n_tokens_neox': 2064, 'n_words': 725}