Skip to content

Commit 30f76ab

Browse files
committed
add config
1 parent 9c29a58 commit 30f76ab

File tree

8 files changed

+26
-21
lines changed

8 files changed

+26
-21
lines changed

AccessoryKit.podspec

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
Pod::Spec.new do |s|
22
s.name = 'AccessoryKit'
3-
s.version = '2.0.0'
3+
s.version = '2.0.1'
44
s.summary = 'A customizable, expandable, and easy-to-use input accessory view component for iOS.'
55

66
s.description = <<-DESC
77
A customizable, expandable, and easy-to-use input accessory view component for iOS.
8+
Automatically adapts for iPhone and iPad.
89
DESC
910

1011
s.homepage = 'https://github.com/xnth97/AccessoryKit'
1112
s.license = { :type => 'MIT', :file => 'LICENSE' }
1213
s.author = { 'Yubo Qin' => '[email protected]' }
14+
s.readme = 'https://raw.githubusercontent.com/xnth97/AccessoryKit/#{s.version.to_s}/README.md'
1315
s.source = { :git => 'https://github.com/xnth97/AccessoryKit.git', :tag => s.version.to_s }
1416

1517
s.ios.deployment_target = '14.0'
1618
s.swift_version = '5.7'
1719

18-
s.source_files = 'Sources/AccessoryKit/**/*'
20+
s.source_files = 'Sources/AccessoryKit/**/*.{swift}'
1921

2022
s.frameworks = 'UIKit'
2123

Example/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PODS:
2-
- AccessoryKit (2.0.0)
2+
- AccessoryKit (2.0.1)
33

44
DEPENDENCIES:
55
- AccessoryKit (from `../`)
@@ -9,7 +9,7 @@ EXTERNAL SOURCES:
99
:path: "../"
1010

1111
SPEC CHECKSUMS:
12-
AccessoryKit: 3bccba03d7a73822cbb692729078760314a45cc7
12+
AccessoryKit: cf9b513ebe3cd10ec76089f89c743a686127bae2
1313

1414
PODFILE CHECKSUM: 71ba08049996c0cee05530889ad335543ac96aac
1515

Example/Pods/Local Podspecs/AccessoryKit.podspec.json

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Manifest.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Target Support Files/AccessoryKit/AccessoryKit-Info.plist

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/AccessoryKit/KeyboardAccessoryButtonView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class KeyboardAccessoryButtonView: UIView {
4040
}
4141

4242
button.backgroundColor = .secondarySystemBackground
43+
button.isPointerInteractionEnabled = true
4344

4445
if !ignoreCornerRadius {
4546
button.clipsToBounds = true

Sources/AccessoryKit/KeyboardAccessoryManager.swift

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public class KeyboardAccessoryManager {
2222
private let keyHeight: CGFloat
2323
private let keyCornerRadius: CGFloat
2424
private let showDismissKeyboardKey: Bool
25+
private let preferInputAssistantItem: Bool
2526

2627
private weak var delegate: KeyboardAccessoryViewDelegate?
2728
private var identifiedActionItems: [String: Any] = [:]
@@ -36,20 +37,23 @@ public class KeyboardAccessoryManager {
3637
/// - keyCornerRadius: The corner radius of each key inside input accessory view.
3738
/// - keyMargin: The margin between keys inside input accessory view.
3839
/// - showDismissKeyboardKey: If show the dismiss keyboard key on the right of scrollable area.
40+
/// - preferInputAssistantItem: Prefer `UITextInputAssistantItem` on iPads.
3941
/// - delegate: Delegate object that implements `KeyboardAccessoryViewDelegate`.
4042
public init(keyButtonGroups: [KeyboardAccessoryButtonGroup] = [],
4143
keyWidth: CGFloat = KeyboardAccessoryView.defaultKeyWidth,
4244
keyHeight: CGFloat = KeyboardAccessoryView.defaultKeyHeight,
4345
keyCornerRadius: CGFloat = KeyboardAccessoryView.defaultKeyCornerRadius,
4446
keyMargin: CGFloat = KeyboardAccessoryView.defaultKeyMargin,
4547
showDismissKeyboardKey: Bool = true,
48+
preferInputAssistantItem: Bool = true,
4649
delegate: KeyboardAccessoryViewDelegate? = nil) {
4750
self.keyButtonGroups = keyButtonGroups
4851
self.keyMargin = keyMargin
4952
self.keyWidth = keyWidth
5053
self.keyHeight = keyHeight
5154
self.keyCornerRadius = keyCornerRadius
5255
self.showDismissKeyboardKey = showDismissKeyboardKey
56+
self.preferInputAssistantItem = preferInputAssistantItem
5357
self.delegate = delegate
5458
}
5559

@@ -60,7 +64,7 @@ public class KeyboardAccessoryManager {
6064
/// the floating keyboard toolbar).
6165
/// - Parameter textView: The text view instance to be configured.
6266
public func configure(textView: UITextView) {
63-
if Self.isIPad {
67+
if canUseInputAssistantItem {
6468
configure(inputAssistantItem: textView.inputAssistantItem)
6569
} else {
6670
textView.inputAccessoryView = inputAccessoryView
@@ -72,7 +76,7 @@ public class KeyboardAccessoryManager {
7276
/// the floating keyboard toolbar).
7377
/// - Parameter textField: The text field instance to be cofigured.
7478
public func configure(textField: UITextField) {
75-
if Self.isIPad {
79+
if canUseInputAssistantItem {
7680
configure(inputAssistantItem: textField.inputAssistantItem)
7781
} else {
7882
textField.inputAccessoryView = inputAccessoryView
@@ -181,7 +185,7 @@ public class KeyboardAccessoryManager {
181185
/// - enabled: Boolean value indicating whether the key is enabled.
182186
/// - identifier: Identifier of menu item.
183187
public func setEnabled(_ enabled: Bool, for identifier: String) {
184-
if Self.isIPad {
188+
if canUseInputAssistantItem {
185189
if let item = identifiedActionItems[identifier] {
186190
switch item {
187191
case is UIAction:
@@ -212,4 +216,8 @@ public class KeyboardAccessoryManager {
212216
return UIDevice.current.userInterfaceIdiom == .pad
213217
}
214218

219+
private var canUseInputAssistantItem: Bool {
220+
preferInputAssistantItem && Self.isIPad
221+
}
222+
215223
}

Tests/LinuxMain.swift

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)