Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/woollim/combinekeyboard
https://github.com/woollim/combinekeyboard
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/woollim/combinekeyboard
- Owner: Woollim
- License: mit
- Created: 2020-10-15T15:48:48.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2020-10-16T19:10:27.000Z (about 4 years ago)
- Last Synced: 2024-09-17T13:29:06.386Z (3 months ago)
- Language: Swift
- Size: 19.5 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# CombineKeyboard
![Swift](https://img.shields.io/badge/Swift-5.0-orange.svg)
CombineKeyboard is a way to getting keyboard frame or height with Combine, inspired by the RxSwift Community's [RxKeyboard](https://github.com/RxSwiftCommunity/RxKeyboard) library.
## Usage
CombineKeyboard provides three `Publisher`s. (If you want more Publisher, you can contributes this library)
```swift
/// A publisher emitting current keyboard `frame`
/// You will be returned the current keyboard `frame` at start of subscription.
public var frame: AnyPublisher/// A publisher emitting current keyboard `height`
/// You will be returned the current keyboard `height` at start of subscription.
public var height: AnyPublisher
/// A publisher emitting current keyboard `height` when keyboard's height is updated
public var heightUpdated: AnyPublisher
```You can use three `Publisher`s with `CombineKeyboard.shared`
```swift
CombineKeyboard.shared.frame
.sink(receiveValue: { frame: CGRect in
print(frame)
})
.store(in: &cancellables)CombineKeyboard.shared.height
.sink(receiveValue: { currentHeight: CGFloat in
print(currentHeight)
})
.store(in: &cancellables)
CombineKeyboard.shared.heightUpdated
.sink(receiveValue: { height: CGFloat in
print(height)
})
.store(in: &cancellables)
```## Requirements
- Swift 5
- iOS 13 +## Installation
CombineKeyboard is available through [CocoaPods](https://cocoapods.org). To install
it, simply add the following line to your Podfile:```ruby
pod 'CombineKeyboard'
```## License
CombineKeyboard is available under the MIT license. See the LICENSE file for more info.
---
This Library was made inspired by [RxKeyboard](https://github.com/RxSwiftCommunity/RxKeyboard) library. thanks to [RxKeyboard's Contributers](https://github.com/RxSwiftCommunity/RxKeyboard/graphs/contributors)