├── MGKeyboardAccessory
├── Assets
│ └── .gitkeep
└── Classes
│ ├── .gitkeep
│ ├── Core
│ ├── MGKeyboardAccessory.swift
│ └── AccessoryToolbar.swift
│ └── Rx
│ └── MGKeyboardAccessory+Rx.swift
├── _Pods.xcodeproj
├── screenshot
└── demo.png
├── Example
├── MGKeyboardAccessory
│ ├── Images.xcassets
│ │ ├── Contents.json
│ │ └── AppIcon.appiconset
│ │ │ ├── Icon-60@2x.png
│ │ │ ├── Icon-60@3x.png
│ │ │ └── Contents.json
│ ├── AppDelegate.swift
│ ├── ViewController.swift
│ ├── Info.plist
│ └── Base.lproj
│ │ ├── LaunchScreen.xib
│ │ └── Main.storyboard
├── Podfile
├── MGKeyboardAccessory.xcodeproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ ├── xcshareddata
│ │ └── xcschemes
│ │ │ └── MGKeyboardAccessory-Example.xcscheme
│ └── project.pbxproj
├── Tests
│ ├── Info.plist
│ └── Tests.swift
└── Podfile.lock
├── .travis.yml
├── .gitignore
├── LICENSE
├── MGKeyboardAccessory.podspec
└── README.md
/MGKeyboardAccessory/Assets/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/MGKeyboardAccessory/Classes/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/_Pods.xcodeproj:
--------------------------------------------------------------------------------
1 | Example/Pods/Pods.xcodeproj
--------------------------------------------------------------------------------
/screenshot/demo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lm2343635/MGKeyboardAccessory/HEAD/screenshot/demo.png
--------------------------------------------------------------------------------
/Example/MGKeyboardAccessory/Images.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Example/MGKeyboardAccessory/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lm2343635/MGKeyboardAccessory/HEAD/Example/MGKeyboardAccessory/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png
--------------------------------------------------------------------------------
/Example/MGKeyboardAccessory/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lm2343635/MGKeyboardAccessory/HEAD/Example/MGKeyboardAccessory/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png
--------------------------------------------------------------------------------
/Example/Podfile:
--------------------------------------------------------------------------------
1 | use_frameworks!
2 | platform :ios, '10.0'
3 |
4 | target 'MGKeyboardAccessory_Example' do
5 | pod 'MGKeyboardAccessory/Rx', :path => '../'
6 |
7 | target 'MGKeyboardAccessory_Tests' do
8 | inherit! :search_paths
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/Example/MGKeyboardAccessory.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | # references:
2 | # * http://www.objc.io/issue-6/travis-ci.html
3 | # * https://github.com/supermarin/xcpretty#usage
4 |
5 | osx_image: xcode11.2
6 | language: objective-c
7 | cache: cocoapods
8 | podfile: Example/Podfile
9 |
10 | before_install:
11 | - gem install cocoapods # Since Travis is not always on latest version
12 | - pod repo update
13 | - pod install --project-directory=Example
14 |
15 | script:
16 | - set -o pipefail && xcodebuild -workspace Example/MGKeyboardAccessory.xcworkspace -scheme MGKeyboardAccessory-Example -sdk iphonesimulator build CODE_SIGNING_REQUIRED=NO | xcpretty -c
17 | - pod lib lint
18 |
--------------------------------------------------------------------------------
/Example/MGKeyboardAccessory/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // MGKeyboardAccessory
4 | //
5 | // Created by Meng Li on 01/22/2017.
6 | // Copyright (c) 2017 MuShare. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
17 | // Override point for customization after application launch.
18 | return true
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # OS X
2 | .DS_Store
3 |
4 | # Xcode
5 | build/
6 | *.pbxuser
7 | !default.pbxuser
8 | *.mode1v3
9 | !default.mode1v3
10 | *.mode2v3
11 | !default.mode2v3
12 | *.perspectivev3
13 | !default.perspectivev3
14 | xcuserdata/
15 | *.xccheckout
16 | profile
17 | *.moved-aside
18 | DerivedData
19 | *.hmap
20 | *.ipa
21 |
22 | # Pod
23 | Example/MGKeyboardAccessory.xcworkspace/
24 | Example/Pods/
25 |
26 | # Bundler
27 | .bundle
28 |
29 | Carthage
30 | # We recommend against adding the Pods directory to your .gitignore. However
31 | # you should judge for yourself, the pros and cons are mentioned at:
32 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
33 | #
34 | # Note: if you ignore the Pods directory, make sure to uncomment
35 | # `pod install` in .travis.yml
36 | #
37 | # Pods/
38 |
--------------------------------------------------------------------------------
/Example/Tests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Example/Tests/Tests.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import XCTest
3 | import MGKeyboardAccessory
4 |
5 | class Tests: XCTestCase {
6 |
7 | override func setUp() {
8 | super.setUp()
9 | // Put setup code here. This method is called before the invocation of each test method in the class.
10 | }
11 |
12 | override func tearDown() {
13 | // Put teardown code here. This method is called after the invocation of each test method in the class.
14 | super.tearDown()
15 | }
16 |
17 | func testExample() {
18 | // This is an example of a functional test case.
19 | XCTAssert(true, "Pass")
20 | }
21 |
22 | func testPerformanceExample() {
23 | // This is an example of a performance test case.
24 | self.measure() {
25 | // Put the code you want to measure the time of here.
26 | }
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/Example/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - MGKeyboardAccessory/Core (0.7)
3 | - MGKeyboardAccessory/Rx (0.7):
4 | - MGKeyboardAccessory/Core (~> 0)
5 | - RxCocoa (~> 6)
6 | - RxCocoa (6.5.0):
7 | - RxRelay (= 6.5.0)
8 | - RxSwift (= 6.5.0)
9 | - RxRelay (6.5.0):
10 | - RxSwift (= 6.5.0)
11 | - RxSwift (6.5.0)
12 |
13 | DEPENDENCIES:
14 | - MGKeyboardAccessory/Rx (from `../`)
15 |
16 | SPEC REPOS:
17 | trunk:
18 | - RxCocoa
19 | - RxRelay
20 | - RxSwift
21 |
22 | EXTERNAL SOURCES:
23 | MGKeyboardAccessory:
24 | :path: "../"
25 |
26 | SPEC CHECKSUMS:
27 | MGKeyboardAccessory: 91ca768e22794a64871e68ce264509a0d1ef2a06
28 | RxCocoa: 94f817b71c07517321eb4f9ad299112ca8af743b
29 | RxRelay: 1de1523e604c72b6c68feadedd1af3b1b4d0ecbd
30 | RxSwift: 5710a9e6b17f3c3d6e40d6e559b9fa1e813b2ef8
31 |
32 | PODFILE CHECKSUM: acd85a5db5bda843f116c2d42c7fe9e323505be4
33 |
34 | COCOAPODS: 1.11.3
35 |
--------------------------------------------------------------------------------
/Example/MGKeyboardAccessory/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "60x60",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-60@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "60x60",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-60@3x.png",
43 | "scale" : "3x"
44 | }
45 | ],
46 | "info" : {
47 | "version" : 1,
48 | "author" : "xcode"
49 | }
50 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2017 limeng
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/Example/MGKeyboardAccessory/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // MGKeyboardAccessory
4 | //
5 | // Created by Meng Li on 01/22/2017.
6 | // Copyright (c) 2017 MuShare. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import MGKeyboardAccessory
11 | import RxSwift
12 |
13 | class ViewController: UIViewController {
14 |
15 | @IBOutlet weak var blackTextField: UITextField!
16 | @IBOutlet weak var defaultTextField: UITextField!
17 | @IBOutlet weak var textView: UITextView!
18 |
19 | private let disposeBag = DisposeBag()
20 |
21 | override func viewDidLoad() {
22 | super.viewDidLoad()
23 |
24 | blackTextField.becomeFirstResponder()
25 | blackTextField.setupKeyboardAccessory([":", "/", "?", "&", "alice", "=", "*", "-", "@", "~"], barStyle: .black)
26 | defaultTextField.setupKeyboardAccessory([":", "/", "?", "&", ".", "="], barStyle: .default)
27 |
28 | Observable.just([":", "/", "?", "&", ".", "="])
29 | .bind(to: textView.rx.keyboardAccessoryStrings(style: .black)).disposed(by: disposeBag)
30 | }
31 |
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/Example/MGKeyboardAccessory/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/MGKeyboardAccessory.podspec:
--------------------------------------------------------------------------------
1 | #
2 | # Be sure to run `pod lib lint MGKeyboardAccessory.podspec' to ensure this is a
3 | # valid spec before submitting.
4 | #
5 | # Any lines starting with a # are optional, but their use is encouraged
6 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
7 | #
8 |
9 | Pod::Spec.new do |s|
10 | s.name = 'MGKeyboardAccessory'
11 | s.version = '0.7'
12 | s.summary = 'A keyboard accessory to input special characters.'
13 |
14 | s.description = <<-DESC
15 | MGKeyboardAccessory is a keyboard accessory to input special characters in UITextField or UI directly. It allows developers to add the custom button with characters in keyboard accessory, characters in the button will be inserted to text field if the button is clicked.
16 | # Features
17 | - Support custom characters.
18 | - Support two styles: defualt and dark.
19 | - Support both UITextField and UITextView.
20 | DESC
21 |
22 | s.homepage = 'https://github.com/lm2343635/MGKeyboardAccessory'
23 | s.license = { :type => 'MIT', :file => 'LICENSE' }
24 | s.author = { 'Meng Li' => 'lm2343635@126.com' }
25 | s.social_media_url = "http://www.fczm.pw"
26 | s.source = { :git => 'https://github.com/lm2343635/MGKeyboardAccessory.git', :tag => s.version.to_s }
27 |
28 | s.ios.deployment_target = '10.0'
29 | s.swift_version = '5.0'
30 |
31 | s.default_subspec = 'Core'
32 |
33 | s.subspec 'Core' do |core|
34 | core.source_files = 'MGKeyboardAccessory/Classes/Core/**/*'
35 | end
36 |
37 | s.subspec 'Rx' do |rx|
38 | rx.dependency 'MGKeyboardAccessory/Core', '~> 0'
39 | rx.dependency 'RxCocoa', '~> 6'
40 | rx.source_files = 'MGKeyboardAccessory/Classes/Rx/**/*'
41 | end
42 |
43 | end
44 |
--------------------------------------------------------------------------------
/MGKeyboardAccessory/Classes/Core/MGKeyboardAccessory.swift:
--------------------------------------------------------------------------------
1 | //
2 | // MGKeyboardAccessory.swift
3 | // MGKeyboardAccessory
4 | //
5 | // Created by Meng Li on 01/22/2017.
6 | // Copyright (c) 2019 MuShare. All rights reserved.
7 | //
8 |
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in
17 | // all copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 | // THE SOFTWARE.
26 |
27 | import Foundation
28 |
29 | public extension UITextField {
30 |
31 | // Add keyboard accessory for text field.
32 | func setupKeyboardAccessory(_ strings: [String], barStyle: UIBarStyle) {
33 | inputAccessoryView = AccessoryToolbar.init(strings, barStyle: barStyle, forTextInput: self)
34 | }
35 |
36 | }
37 |
38 | public extension UITextView {
39 |
40 | // Add keyboard accessory for text view.
41 | func setupKeyboardAccessory(_ strings: [String], barStyle: UIBarStyle) {
42 | inputAccessoryView = AccessoryToolbar.init(strings, barStyle: barStyle, forTextInput: self)
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/MGKeyboardAccessory/Classes/Rx/MGKeyboardAccessory+Rx.swift:
--------------------------------------------------------------------------------
1 | //
2 | // MGKeyboardAccessory.swift
3 | // MGKeyboardAccessory
4 | //
5 | // Created by Meng Li on 04/09/2019.
6 | // Copyright (c) 2019 MuShare. All rights reserved.
7 | //
8 |
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in
17 | // all copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 | // THE SOFTWARE.
26 |
27 | import RxSwift
28 | import RxCocoa
29 |
30 | extension Reactive where Base: UITextField {
31 |
32 | public func keyboardAccessoryStrings(style: UIBarStyle) -> Binder<[String]> {
33 | return Binder(self.base) { (textField, strings) in
34 | textField.setupKeyboardAccessory(strings, barStyle: style)
35 | }
36 | }
37 |
38 | }
39 |
40 | extension Reactive where Base: UITextView {
41 |
42 | public func keyboardAccessoryStrings(style: UIBarStyle) -> Binder<[String]> {
43 | return Binder(self.base) { (textView, strings) in
44 | textView.setupKeyboardAccessory(strings, barStyle: style)
45 | }
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # MGKeyboardAccessory
2 | [](https://travis-ci.org/lm2343635/MGKeyboardAccessory)
3 | [](http://cocoapods.org/pods/MGKeyboardAccessory)
4 | [](http://cocoapods.org/pods/MGKeyboardAccessory)
5 | [](http://cocoapods.org/pods/MGKeyboardAccessory)
6 | [](https://github.com/lm2343635/MGKeyboardAccessory/releases)
7 |
8 | MGKeyboardAccessory is a keyboard accessory to input special characters in UITextField or UI directly. It allows developers to add the custom button with characters in keyboard accessory, characters in the button will be
9 | inserted to text field if the button is clicked.
10 |
11 | 
12 |
13 | ## Features
14 | - Support custom characters.
15 | - Support two styles: defualt and dark.
16 | - Support UITextField, UITextView and their subclasses.
17 |
18 | ## Example
19 |
20 | To run the example project, clone the repo, and run `pod install` from the Example directory first.
21 |
22 | ## Installation
23 |
24 | MGKeyboardAccessory is available through [CocoaPods](http://cocoapods.org). To install
25 | it, simply add the following line to your Podfile:
26 |
27 | ```ruby
28 | pod 'MGKeyboardAccessory'
29 | ```
30 |
31 | ## How to use
32 | Build and import the module:
33 |
34 | ```swift
35 | import MGKeyboardAccessory
36 | ```
37 |
38 | It is very simple to add a keyboard accessoray for text field. In our demo, we added a black style accessoray:
39 |
40 | ```swift
41 | blackTextField.setupKeyboardAccessory([":", "/", "\""], barStyle: .black)
42 | ```
43 |
44 | The first parameter is a string array to create custom button, the second parameter is the bar style. Use **UIBarStyle** provided by UIKit directly.
45 |
46 | #### Reactive extension for RxSwift
47 |
48 | MGKeyboardAccessory also supports reactive extension for RxSwift.
49 |
50 | ```Swift
51 | Observable.just([":", "/", "?", "&", ".", "="])
52 | .bind(to: textView.rx.keyboardAccessoryStrings(style: .black)).disposed(by: disposeBag)
53 | ```
54 |
55 | ## Author
56 |
57 | Meng Li, https://fczm.pw, lm2343635@126.com
58 |
59 | ## License
60 |
61 | MGKeyboardAccessory is available under the MIT license. See the LICENSE file for more info.
62 |
63 |
64 |
--------------------------------------------------------------------------------
/Example/MGKeyboardAccessory/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
24 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/Example/MGKeyboardAccessory.xcodeproj/xcshareddata/xcschemes/MGKeyboardAccessory-Example.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
47 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
65 |
66 |
67 |
68 |
78 |
80 |
86 |
87 |
88 |
89 |
90 |
91 |
97 |
99 |
105 |
106 |
107 |
108 |
110 |
111 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/MGKeyboardAccessory/Classes/Core/AccessoryToolbar.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AccessoryToolbar.swift
3 | // MGKeyboardAccessory
4 | //
5 | // Created by Meng Li on 12/08/2017.
6 | // Copyright (c) 2019 MuShare. All rights reserved.
7 | //
8 |
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in
17 | // all copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 | // THE SOFTWARE.
26 |
27 | import Foundation
28 |
29 | class AccessoryToolbar: UIToolbar {
30 |
31 | private lazy var clearBarButtonItem: UIBarButtonItem = {
32 | let barButtonItem = UIBarButtonItem(
33 | barButtonSystemItem: .trash,
34 | target: self,
35 | action: #selector(clearTextFeild)
36 | )
37 | barButtonItem.tintColor = buttonColor
38 | return barButtonItem
39 | }()
40 |
41 | private lazy var spaceBarButtonItem = UIBarButtonItem(
42 | barButtonSystemItem: .flexibleSpace,
43 | target: self,
44 | action: nil
45 | )
46 |
47 | private lazy var doneBarButtonItem: UIBarButtonItem = {
48 | let barButtonItem = UIBarButtonItem(
49 | barButtonSystemItem: .done,
50 | target: self,
51 | action: #selector(editFinish)
52 | )
53 | barButtonItem.width = 150
54 | barButtonItem.tintColor = buttonColor
55 | return barButtonItem
56 | }()
57 |
58 | private var textInput: UITextInput?
59 |
60 | private var buttonColor: UIColor {
61 | barStyle == .default ? .darkGray : .white
62 | }
63 |
64 | public init(_ strings: [String], barStyle: UIBarStyle, forTextInput: UITextInput) {
65 | super.init(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 35))
66 | self.textInput = forTextInput
67 | self.barStyle = barStyle
68 |
69 | setItems([
70 | clearBarButtonItem,
71 | spaceBarButtonItem,
72 | createStringBarButtonItem(
73 | strings: strings,
74 | color: buttonColor,
75 | action: #selector(addText(_:)),
76 | height: 26
77 | ),
78 | spaceBarButtonItem,
79 | doneBarButtonItem
80 | ], animated: false)
81 | }
82 |
83 | required init?(coder aDecoder: NSCoder) {
84 | super.init(coder: aDecoder)
85 | }
86 |
87 | func createStringBarButtonItem(strings: [String], color: UIColor, action: Selector, height: CGFloat) -> UIBarButtonItem {
88 | let buttonsView = UIScrollView()
89 | var x: CGFloat = 0
90 | var width: CGFloat = 0
91 | for string in strings {
92 | let stringButton: UIButton = {
93 | let button = UIButton(type: .custom)
94 | button.setTitle(string, for: .normal)
95 | width = button.sizeThatFits(CGSize.init(width: CGFloat.greatestFiniteMagnitude, height: height)).width
96 | if width > height * 1.2 {
97 | width += height / 4;
98 | }
99 | button.frame = CGRect(x: x, y: 0, width: width, height: height)
100 | button.layer.cornerRadius = 5
101 | button.layer.borderWidth = 1
102 | button.layer.borderColor = color.cgColor
103 | button.tintColor = color
104 | button.setTitleColor(color, for: .normal)
105 | button.addTarget(target, action: action, for: .touchUpInside)
106 | return button
107 | }()
108 | buttonsView.addSubview(stringButton)
109 | x += 2 + width
110 | }
111 | // If button width is larger than the max avaliable width for all character buttons,
112 | // set screen width - 110 as button width.
113 | var buttonWidth = x - 2
114 | if UIScreen.main.bounds.width - 130 < buttonWidth {
115 | buttonWidth = UIScreen.main.bounds.width - 130
116 | }
117 | buttonsView.frame = CGRect(x: 0, y: 0, width: buttonWidth, height: height)
118 | buttonsView.contentSize = CGSize(width: x - 2, height: 0)
119 | buttonsView.showsHorizontalScrollIndicator = false
120 | let characterButtonItem = UIBarButtonItem(customView: buttonsView)
121 | return characterButtonItem
122 | }
123 |
124 | @objc func addText(_ sender: UIButton) {
125 | guard let text = sender.titleLabel?.text else {
126 | return
127 | }
128 | if let textFiled = textInput as? UITextField {
129 | textFiled.insertText(text)
130 | } else if let textView = textInput as? UITextView {
131 | textView.insertText(text)
132 | }
133 | }
134 |
135 | @objc func editFinish() {
136 | if let textFiled = textInput as? UITextField {
137 | if textFiled.isFirstResponder {
138 | textFiled.resignFirstResponder()
139 | }
140 | } else if let textView = textInput as? UITextView {
141 | if textView.isFirstResponder {
142 | textView.resignFirstResponder()
143 | }
144 | }
145 | }
146 |
147 | @objc func clearTextFeild() {
148 | if let textFiled = textInput as? UITextField {
149 | if textFiled.isFirstResponder {
150 | textFiled.text = nil
151 | }
152 | } else if let textView = textInput as? UITextView {
153 | if textView.isFirstResponder {
154 | textView.text = nil
155 | }
156 | }
157 | }
158 |
159 | }
160 |
--------------------------------------------------------------------------------
/Example/MGKeyboardAccessory/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/Example/MGKeyboardAccessory.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 5675916A585858011266909E /* Pods_MGKeyboardAccessory_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4267CF91D767310EFCDF0F48 /* Pods_MGKeyboardAccessory_Tests.framework */; };
11 | 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; };
12 | 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ViewController.swift */; };
13 | 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; };
14 | 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; };
15 | 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; };
16 | 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; };
17 | 78D9F908EAF8A25503EDC654 /* Pods_MGKeyboardAccessory_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1590D93737748011355BD9D3 /* Pods_MGKeyboardAccessory_Example.framework */; };
18 | /* End PBXBuildFile section */
19 |
20 | /* Begin PBXContainerItemProxy section */
21 | 607FACE61AFB9204008FA782 /* PBXContainerItemProxy */ = {
22 | isa = PBXContainerItemProxy;
23 | containerPortal = 607FACC81AFB9204008FA782 /* Project object */;
24 | proxyType = 1;
25 | remoteGlobalIDString = 607FACCF1AFB9204008FA782;
26 | remoteInfo = MGKeyboardAccessory;
27 | };
28 | /* End PBXContainerItemProxy section */
29 |
30 | /* Begin PBXFileReference section */
31 | 1590D93737748011355BD9D3 /* Pods_MGKeyboardAccessory_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MGKeyboardAccessory_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
32 | 4267CF91D767310EFCDF0F48 /* Pods_MGKeyboardAccessory_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MGKeyboardAccessory_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
33 | 49E3C9FEA44594BE4941C2BF /* Pods-MGKeyboardAccessory_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MGKeyboardAccessory_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-MGKeyboardAccessory_Example/Pods-MGKeyboardAccessory_Example.debug.xcconfig"; sourceTree = ""; };
34 | 607FACD01AFB9204008FA782 /* MGKeyboardAccessory_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MGKeyboardAccessory_Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
35 | 607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
36 | 607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
37 | 607FACD71AFB9204008FA782 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; };
38 | 607FACDA1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
39 | 607FACDC1AFB9204008FA782 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
40 | 607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; };
41 | 607FACE51AFB9204008FA782 /* MGKeyboardAccessory_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MGKeyboardAccessory_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
42 | 607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
43 | 607FACEB1AFB9204008FA782 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = ""; };
44 | 8194FF2C124F3FE681A90528 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; };
45 | 94EEAF907E8CCFBCCE6E1E7C /* Pods-MGKeyboardAccessory_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MGKeyboardAccessory_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-MGKeyboardAccessory_Example/Pods-MGKeyboardAccessory_Example.release.xcconfig"; sourceTree = ""; };
46 | A393079F4D66AD3A8B0B0722 /* Pods-MGKeyboardAccessory_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MGKeyboardAccessory_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-MGKeyboardAccessory_Tests/Pods-MGKeyboardAccessory_Tests.debug.xcconfig"; sourceTree = ""; };
47 | A4537526F5185555F8B5656A /* MGKeyboardAccessory.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = MGKeyboardAccessory.podspec; path = ../MGKeyboardAccessory.podspec; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
48 | D8037EC7A7E21A2BA494E15B /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; };
49 | DF101DDDD9B60DEA3880A1B2 /* Pods-MGKeyboardAccessory_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MGKeyboardAccessory_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-MGKeyboardAccessory_Tests/Pods-MGKeyboardAccessory_Tests.release.xcconfig"; sourceTree = ""; };
50 | /* End PBXFileReference section */
51 |
52 | /* Begin PBXFrameworksBuildPhase section */
53 | 607FACCD1AFB9204008FA782 /* Frameworks */ = {
54 | isa = PBXFrameworksBuildPhase;
55 | buildActionMask = 2147483647;
56 | files = (
57 | 78D9F908EAF8A25503EDC654 /* Pods_MGKeyboardAccessory_Example.framework in Frameworks */,
58 | );
59 | runOnlyForDeploymentPostprocessing = 0;
60 | };
61 | 607FACE21AFB9204008FA782 /* Frameworks */ = {
62 | isa = PBXFrameworksBuildPhase;
63 | buildActionMask = 2147483647;
64 | files = (
65 | 5675916A585858011266909E /* Pods_MGKeyboardAccessory_Tests.framework in Frameworks */,
66 | );
67 | runOnlyForDeploymentPostprocessing = 0;
68 | };
69 | /* End PBXFrameworksBuildPhase section */
70 |
71 | /* Begin PBXGroup section */
72 | 0EF06589172ABC3766C2D3DA /* Pods */ = {
73 | isa = PBXGroup;
74 | children = (
75 | 49E3C9FEA44594BE4941C2BF /* Pods-MGKeyboardAccessory_Example.debug.xcconfig */,
76 | 94EEAF907E8CCFBCCE6E1E7C /* Pods-MGKeyboardAccessory_Example.release.xcconfig */,
77 | A393079F4D66AD3A8B0B0722 /* Pods-MGKeyboardAccessory_Tests.debug.xcconfig */,
78 | DF101DDDD9B60DEA3880A1B2 /* Pods-MGKeyboardAccessory_Tests.release.xcconfig */,
79 | );
80 | name = Pods;
81 | sourceTree = "";
82 | };
83 | 607FACC71AFB9204008FA782 = {
84 | isa = PBXGroup;
85 | children = (
86 | 607FACF51AFB993E008FA782 /* Podspec Metadata */,
87 | 607FACD21AFB9204008FA782 /* Example for MGKeyboardAccessory */,
88 | 607FACE81AFB9204008FA782 /* Tests */,
89 | 607FACD11AFB9204008FA782 /* Products */,
90 | 0EF06589172ABC3766C2D3DA /* Pods */,
91 | AF58FDF09B2D2DDAE8189EA3 /* Frameworks */,
92 | );
93 | sourceTree = "";
94 | };
95 | 607FACD11AFB9204008FA782 /* Products */ = {
96 | isa = PBXGroup;
97 | children = (
98 | 607FACD01AFB9204008FA782 /* MGKeyboardAccessory_Example.app */,
99 | 607FACE51AFB9204008FA782 /* MGKeyboardAccessory_Tests.xctest */,
100 | );
101 | name = Products;
102 | sourceTree = "";
103 | };
104 | 607FACD21AFB9204008FA782 /* Example for MGKeyboardAccessory */ = {
105 | isa = PBXGroup;
106 | children = (
107 | 607FACD51AFB9204008FA782 /* AppDelegate.swift */,
108 | 607FACD71AFB9204008FA782 /* ViewController.swift */,
109 | 607FACD91AFB9204008FA782 /* Main.storyboard */,
110 | 607FACDC1AFB9204008FA782 /* Images.xcassets */,
111 | 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */,
112 | 607FACD31AFB9204008FA782 /* Supporting Files */,
113 | );
114 | name = "Example for MGKeyboardAccessory";
115 | path = MGKeyboardAccessory;
116 | sourceTree = "";
117 | };
118 | 607FACD31AFB9204008FA782 /* Supporting Files */ = {
119 | isa = PBXGroup;
120 | children = (
121 | 607FACD41AFB9204008FA782 /* Info.plist */,
122 | );
123 | name = "Supporting Files";
124 | sourceTree = "";
125 | };
126 | 607FACE81AFB9204008FA782 /* Tests */ = {
127 | isa = PBXGroup;
128 | children = (
129 | 607FACEB1AFB9204008FA782 /* Tests.swift */,
130 | 607FACE91AFB9204008FA782 /* Supporting Files */,
131 | );
132 | path = Tests;
133 | sourceTree = "";
134 | };
135 | 607FACE91AFB9204008FA782 /* Supporting Files */ = {
136 | isa = PBXGroup;
137 | children = (
138 | 607FACEA1AFB9204008FA782 /* Info.plist */,
139 | );
140 | name = "Supporting Files";
141 | sourceTree = "";
142 | };
143 | 607FACF51AFB993E008FA782 /* Podspec Metadata */ = {
144 | isa = PBXGroup;
145 | children = (
146 | A4537526F5185555F8B5656A /* MGKeyboardAccessory.podspec */,
147 | D8037EC7A7E21A2BA494E15B /* README.md */,
148 | 8194FF2C124F3FE681A90528 /* LICENSE */,
149 | );
150 | name = "Podspec Metadata";
151 | sourceTree = "";
152 | };
153 | AF58FDF09B2D2DDAE8189EA3 /* Frameworks */ = {
154 | isa = PBXGroup;
155 | children = (
156 | 1590D93737748011355BD9D3 /* Pods_MGKeyboardAccessory_Example.framework */,
157 | 4267CF91D767310EFCDF0F48 /* Pods_MGKeyboardAccessory_Tests.framework */,
158 | );
159 | name = Frameworks;
160 | sourceTree = "";
161 | };
162 | /* End PBXGroup section */
163 |
164 | /* Begin PBXNativeTarget section */
165 | 607FACCF1AFB9204008FA782 /* MGKeyboardAccessory_Example */ = {
166 | isa = PBXNativeTarget;
167 | buildConfigurationList = 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "MGKeyboardAccessory_Example" */;
168 | buildPhases = (
169 | EFF9B002D7E448661A494B44 /* [CP] Check Pods Manifest.lock */,
170 | 607FACCC1AFB9204008FA782 /* Sources */,
171 | 607FACCD1AFB9204008FA782 /* Frameworks */,
172 | 607FACCE1AFB9204008FA782 /* Resources */,
173 | 77396290225C7A1A0091C669 /* Rebuild Pods */,
174 | 805D11831E63B0797F08A674 /* [CP] Embed Pods Frameworks */,
175 | );
176 | buildRules = (
177 | );
178 | dependencies = (
179 | );
180 | name = MGKeyboardAccessory_Example;
181 | productName = MGKeyboardAccessory;
182 | productReference = 607FACD01AFB9204008FA782 /* MGKeyboardAccessory_Example.app */;
183 | productType = "com.apple.product-type.application";
184 | };
185 | 607FACE41AFB9204008FA782 /* MGKeyboardAccessory_Tests */ = {
186 | isa = PBXNativeTarget;
187 | buildConfigurationList = 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "MGKeyboardAccessory_Tests" */;
188 | buildPhases = (
189 | 30D3C73047B94E4F3DC8AFDB /* [CP] Check Pods Manifest.lock */,
190 | 607FACE11AFB9204008FA782 /* Sources */,
191 | 607FACE21AFB9204008FA782 /* Frameworks */,
192 | 607FACE31AFB9204008FA782 /* Resources */,
193 | );
194 | buildRules = (
195 | );
196 | dependencies = (
197 | 607FACE71AFB9204008FA782 /* PBXTargetDependency */,
198 | );
199 | name = MGKeyboardAccessory_Tests;
200 | productName = Tests;
201 | productReference = 607FACE51AFB9204008FA782 /* MGKeyboardAccessory_Tests.xctest */;
202 | productType = "com.apple.product-type.bundle.unit-test";
203 | };
204 | /* End PBXNativeTarget section */
205 |
206 | /* Begin PBXProject section */
207 | 607FACC81AFB9204008FA782 /* Project object */ = {
208 | isa = PBXProject;
209 | attributes = {
210 | LastSwiftUpdateCheck = 0720;
211 | LastUpgradeCheck = 1020;
212 | ORGANIZATIONNAME = CocoaPods;
213 | TargetAttributes = {
214 | 607FACCF1AFB9204008FA782 = {
215 | CreatedOnToolsVersion = 6.3.1;
216 | LastSwiftMigration = 1020;
217 | };
218 | 607FACE41AFB9204008FA782 = {
219 | CreatedOnToolsVersion = 6.3.1;
220 | LastSwiftMigration = 1020;
221 | TestTargetID = 607FACCF1AFB9204008FA782;
222 | };
223 | };
224 | };
225 | buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "MGKeyboardAccessory" */;
226 | compatibilityVersion = "Xcode 3.2";
227 | developmentRegion = en;
228 | hasScannedForEncodings = 0;
229 | knownRegions = (
230 | en,
231 | Base,
232 | );
233 | mainGroup = 607FACC71AFB9204008FA782;
234 | productRefGroup = 607FACD11AFB9204008FA782 /* Products */;
235 | projectDirPath = "";
236 | projectRoot = "";
237 | targets = (
238 | 607FACCF1AFB9204008FA782 /* MGKeyboardAccessory_Example */,
239 | 607FACE41AFB9204008FA782 /* MGKeyboardAccessory_Tests */,
240 | );
241 | };
242 | /* End PBXProject section */
243 |
244 | /* Begin PBXResourcesBuildPhase section */
245 | 607FACCE1AFB9204008FA782 /* Resources */ = {
246 | isa = PBXResourcesBuildPhase;
247 | buildActionMask = 2147483647;
248 | files = (
249 | 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */,
250 | 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */,
251 | 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */,
252 | );
253 | runOnlyForDeploymentPostprocessing = 0;
254 | };
255 | 607FACE31AFB9204008FA782 /* Resources */ = {
256 | isa = PBXResourcesBuildPhase;
257 | buildActionMask = 2147483647;
258 | files = (
259 | );
260 | runOnlyForDeploymentPostprocessing = 0;
261 | };
262 | /* End PBXResourcesBuildPhase section */
263 |
264 | /* Begin PBXShellScriptBuildPhase section */
265 | 30D3C73047B94E4F3DC8AFDB /* [CP] Check Pods Manifest.lock */ = {
266 | isa = PBXShellScriptBuildPhase;
267 | buildActionMask = 2147483647;
268 | files = (
269 | );
270 | inputPaths = (
271 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
272 | "${PODS_ROOT}/Manifest.lock",
273 | );
274 | name = "[CP] Check Pods Manifest.lock";
275 | outputPaths = (
276 | "$(DERIVED_FILE_DIR)/Pods-MGKeyboardAccessory_Tests-checkManifestLockResult.txt",
277 | );
278 | runOnlyForDeploymentPostprocessing = 0;
279 | shellPath = /bin/sh;
280 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
281 | showEnvVarsInLog = 0;
282 | };
283 | 77396290225C7A1A0091C669 /* Rebuild Pods */ = {
284 | isa = PBXShellScriptBuildPhase;
285 | buildActionMask = 2147483647;
286 | files = (
287 | );
288 | inputFileListPaths = (
289 | );
290 | inputPaths = (
291 | );
292 | name = "Rebuild Pods";
293 | outputFileListPaths = (
294 | );
295 | outputPaths = (
296 | );
297 | runOnlyForDeploymentPostprocessing = 0;
298 | shellPath = /bin/sh;
299 | shellScript = "find \"${SRCROOT}/Pods\" -type f -name *frameworks.sh -exec bash -c \"touch \\\"{}\\\"\" \\;\n";
300 | };
301 | 805D11831E63B0797F08A674 /* [CP] Embed Pods Frameworks */ = {
302 | isa = PBXShellScriptBuildPhase;
303 | buildActionMask = 2147483647;
304 | files = (
305 | );
306 | inputPaths = (
307 | "${PODS_ROOT}/Target Support Files/Pods-MGKeyboardAccessory_Example/Pods-MGKeyboardAccessory_Example-frameworks.sh",
308 | "${BUILT_PRODUCTS_DIR}/MGKeyboardAccessory/MGKeyboardAccessory.framework",
309 | "${BUILT_PRODUCTS_DIR}/RxCocoa/RxCocoa.framework",
310 | "${BUILT_PRODUCTS_DIR}/RxRelay/RxRelay.framework",
311 | "${BUILT_PRODUCTS_DIR}/RxSwift/RxSwift.framework",
312 | );
313 | name = "[CP] Embed Pods Frameworks";
314 | outputPaths = (
315 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MGKeyboardAccessory.framework",
316 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxCocoa.framework",
317 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxRelay.framework",
318 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxSwift.framework",
319 | );
320 | runOnlyForDeploymentPostprocessing = 0;
321 | shellPath = /bin/sh;
322 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-MGKeyboardAccessory_Example/Pods-MGKeyboardAccessory_Example-frameworks.sh\"\n";
323 | showEnvVarsInLog = 0;
324 | };
325 | EFF9B002D7E448661A494B44 /* [CP] Check Pods Manifest.lock */ = {
326 | isa = PBXShellScriptBuildPhase;
327 | buildActionMask = 2147483647;
328 | files = (
329 | );
330 | inputPaths = (
331 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
332 | "${PODS_ROOT}/Manifest.lock",
333 | );
334 | name = "[CP] Check Pods Manifest.lock";
335 | outputPaths = (
336 | "$(DERIVED_FILE_DIR)/Pods-MGKeyboardAccessory_Example-checkManifestLockResult.txt",
337 | );
338 | runOnlyForDeploymentPostprocessing = 0;
339 | shellPath = /bin/sh;
340 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
341 | showEnvVarsInLog = 0;
342 | };
343 | /* End PBXShellScriptBuildPhase section */
344 |
345 | /* Begin PBXSourcesBuildPhase section */
346 | 607FACCC1AFB9204008FA782 /* Sources */ = {
347 | isa = PBXSourcesBuildPhase;
348 | buildActionMask = 2147483647;
349 | files = (
350 | 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */,
351 | 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */,
352 | );
353 | runOnlyForDeploymentPostprocessing = 0;
354 | };
355 | 607FACE11AFB9204008FA782 /* Sources */ = {
356 | isa = PBXSourcesBuildPhase;
357 | buildActionMask = 2147483647;
358 | files = (
359 | 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */,
360 | );
361 | runOnlyForDeploymentPostprocessing = 0;
362 | };
363 | /* End PBXSourcesBuildPhase section */
364 |
365 | /* Begin PBXTargetDependency section */
366 | 607FACE71AFB9204008FA782 /* PBXTargetDependency */ = {
367 | isa = PBXTargetDependency;
368 | target = 607FACCF1AFB9204008FA782 /* MGKeyboardAccessory_Example */;
369 | targetProxy = 607FACE61AFB9204008FA782 /* PBXContainerItemProxy */;
370 | };
371 | /* End PBXTargetDependency section */
372 |
373 | /* Begin PBXVariantGroup section */
374 | 607FACD91AFB9204008FA782 /* Main.storyboard */ = {
375 | isa = PBXVariantGroup;
376 | children = (
377 | 607FACDA1AFB9204008FA782 /* Base */,
378 | );
379 | name = Main.storyboard;
380 | sourceTree = "";
381 | };
382 | 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */ = {
383 | isa = PBXVariantGroup;
384 | children = (
385 | 607FACDF1AFB9204008FA782 /* Base */,
386 | );
387 | name = LaunchScreen.xib;
388 | sourceTree = "";
389 | };
390 | /* End PBXVariantGroup section */
391 |
392 | /* Begin XCBuildConfiguration section */
393 | 607FACED1AFB9204008FA782 /* Debug */ = {
394 | isa = XCBuildConfiguration;
395 | buildSettings = {
396 | ALWAYS_SEARCH_USER_PATHS = NO;
397 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
398 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
399 | CLANG_CXX_LIBRARY = "libc++";
400 | CLANG_ENABLE_MODULES = YES;
401 | CLANG_ENABLE_OBJC_ARC = YES;
402 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
403 | CLANG_WARN_BOOL_CONVERSION = YES;
404 | CLANG_WARN_COMMA = YES;
405 | CLANG_WARN_CONSTANT_CONVERSION = YES;
406 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
407 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
408 | CLANG_WARN_EMPTY_BODY = YES;
409 | CLANG_WARN_ENUM_CONVERSION = YES;
410 | CLANG_WARN_INFINITE_RECURSION = YES;
411 | CLANG_WARN_INT_CONVERSION = YES;
412 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
413 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
414 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
415 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
416 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
417 | CLANG_WARN_STRICT_PROTOTYPES = YES;
418 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
419 | CLANG_WARN_UNREACHABLE_CODE = YES;
420 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
421 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
422 | COPY_PHASE_STRIP = NO;
423 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
424 | ENABLE_STRICT_OBJC_MSGSEND = YES;
425 | ENABLE_TESTABILITY = YES;
426 | GCC_C_LANGUAGE_STANDARD = gnu99;
427 | GCC_DYNAMIC_NO_PIC = NO;
428 | GCC_NO_COMMON_BLOCKS = YES;
429 | GCC_OPTIMIZATION_LEVEL = 0;
430 | GCC_PREPROCESSOR_DEFINITIONS = (
431 | "DEBUG=1",
432 | "$(inherited)",
433 | );
434 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
435 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
436 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
437 | GCC_WARN_UNDECLARED_SELECTOR = YES;
438 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
439 | GCC_WARN_UNUSED_FUNCTION = YES;
440 | GCC_WARN_UNUSED_VARIABLE = YES;
441 | IPHONEOS_DEPLOYMENT_TARGET = 10.0;
442 | MTL_ENABLE_DEBUG_INFO = YES;
443 | ONLY_ACTIVE_ARCH = YES;
444 | SDKROOT = iphoneos;
445 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
446 | SWIFT_VERSION = 5.0;
447 | };
448 | name = Debug;
449 | };
450 | 607FACEE1AFB9204008FA782 /* Release */ = {
451 | isa = XCBuildConfiguration;
452 | buildSettings = {
453 | ALWAYS_SEARCH_USER_PATHS = NO;
454 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
455 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
456 | CLANG_CXX_LIBRARY = "libc++";
457 | CLANG_ENABLE_MODULES = YES;
458 | CLANG_ENABLE_OBJC_ARC = YES;
459 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
460 | CLANG_WARN_BOOL_CONVERSION = YES;
461 | CLANG_WARN_COMMA = YES;
462 | CLANG_WARN_CONSTANT_CONVERSION = YES;
463 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
464 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
465 | CLANG_WARN_EMPTY_BODY = YES;
466 | CLANG_WARN_ENUM_CONVERSION = YES;
467 | CLANG_WARN_INFINITE_RECURSION = YES;
468 | CLANG_WARN_INT_CONVERSION = YES;
469 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
470 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
471 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
472 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
473 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
474 | CLANG_WARN_STRICT_PROTOTYPES = YES;
475 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
476 | CLANG_WARN_UNREACHABLE_CODE = YES;
477 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
478 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
479 | COPY_PHASE_STRIP = NO;
480 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
481 | ENABLE_NS_ASSERTIONS = NO;
482 | ENABLE_STRICT_OBJC_MSGSEND = YES;
483 | GCC_C_LANGUAGE_STANDARD = gnu99;
484 | GCC_NO_COMMON_BLOCKS = YES;
485 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
486 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
487 | GCC_WARN_UNDECLARED_SELECTOR = YES;
488 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
489 | GCC_WARN_UNUSED_FUNCTION = YES;
490 | GCC_WARN_UNUSED_VARIABLE = YES;
491 | IPHONEOS_DEPLOYMENT_TARGET = 10.0;
492 | MTL_ENABLE_DEBUG_INFO = NO;
493 | SDKROOT = iphoneos;
494 | SWIFT_COMPILATION_MODE = wholemodule;
495 | SWIFT_VERSION = 5.0;
496 | VALIDATE_PRODUCT = YES;
497 | };
498 | name = Release;
499 | };
500 | 607FACF01AFB9204008FA782 /* Debug */ = {
501 | isa = XCBuildConfiguration;
502 | baseConfigurationReference = 49E3C9FEA44594BE4941C2BF /* Pods-MGKeyboardAccessory_Example.debug.xcconfig */;
503 | buildSettings = {
504 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
505 | INFOPLIST_FILE = MGKeyboardAccessory/Info.plist;
506 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
507 | MODULE_NAME = ExampleApp;
508 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
509 | PRODUCT_NAME = "$(TARGET_NAME)";
510 | SWIFT_VERSION = 5.0;
511 | };
512 | name = Debug;
513 | };
514 | 607FACF11AFB9204008FA782 /* Release */ = {
515 | isa = XCBuildConfiguration;
516 | baseConfigurationReference = 94EEAF907E8CCFBCCE6E1E7C /* Pods-MGKeyboardAccessory_Example.release.xcconfig */;
517 | buildSettings = {
518 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
519 | INFOPLIST_FILE = MGKeyboardAccessory/Info.plist;
520 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
521 | MODULE_NAME = ExampleApp;
522 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
523 | PRODUCT_NAME = "$(TARGET_NAME)";
524 | SWIFT_VERSION = 5.0;
525 | };
526 | name = Release;
527 | };
528 | 607FACF31AFB9204008FA782 /* Debug */ = {
529 | isa = XCBuildConfiguration;
530 | baseConfigurationReference = A393079F4D66AD3A8B0B0722 /* Pods-MGKeyboardAccessory_Tests.debug.xcconfig */;
531 | buildSettings = {
532 | FRAMEWORK_SEARCH_PATHS = (
533 | "$(SDKROOT)/Developer/Library/Frameworks",
534 | "$(inherited)",
535 | );
536 | GCC_PREPROCESSOR_DEFINITIONS = (
537 | "DEBUG=1",
538 | "$(inherited)",
539 | );
540 | INFOPLIST_FILE = Tests/Info.plist;
541 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
542 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
543 | PRODUCT_NAME = "$(TARGET_NAME)";
544 | SWIFT_VERSION = 5.0;
545 | };
546 | name = Debug;
547 | };
548 | 607FACF41AFB9204008FA782 /* Release */ = {
549 | isa = XCBuildConfiguration;
550 | baseConfigurationReference = DF101DDDD9B60DEA3880A1B2 /* Pods-MGKeyboardAccessory_Tests.release.xcconfig */;
551 | buildSettings = {
552 | FRAMEWORK_SEARCH_PATHS = (
553 | "$(SDKROOT)/Developer/Library/Frameworks",
554 | "$(inherited)",
555 | );
556 | INFOPLIST_FILE = Tests/Info.plist;
557 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
558 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
559 | PRODUCT_NAME = "$(TARGET_NAME)";
560 | SWIFT_VERSION = 5.0;
561 | };
562 | name = Release;
563 | };
564 | /* End XCBuildConfiguration section */
565 |
566 | /* Begin XCConfigurationList section */
567 | 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "MGKeyboardAccessory" */ = {
568 | isa = XCConfigurationList;
569 | buildConfigurations = (
570 | 607FACED1AFB9204008FA782 /* Debug */,
571 | 607FACEE1AFB9204008FA782 /* Release */,
572 | );
573 | defaultConfigurationIsVisible = 0;
574 | defaultConfigurationName = Release;
575 | };
576 | 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "MGKeyboardAccessory_Example" */ = {
577 | isa = XCConfigurationList;
578 | buildConfigurations = (
579 | 607FACF01AFB9204008FA782 /* Debug */,
580 | 607FACF11AFB9204008FA782 /* Release */,
581 | );
582 | defaultConfigurationIsVisible = 0;
583 | defaultConfigurationName = Release;
584 | };
585 | 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "MGKeyboardAccessory_Tests" */ = {
586 | isa = XCConfigurationList;
587 | buildConfigurations = (
588 | 607FACF31AFB9204008FA782 /* Debug */,
589 | 607FACF41AFB9204008FA782 /* Release */,
590 | );
591 | defaultConfigurationIsVisible = 0;
592 | defaultConfigurationName = Release;
593 | };
594 | /* End XCConfigurationList section */
595 | };
596 | rootObject = 607FACC81AFB9204008FA782 /* Project object */;
597 | }
598 |
--------------------------------------------------------------------------------