Skip to content

Fix for iOS 14 / Swift 5.3 #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .swift-version

This file was deleted.

10 changes: 6 additions & 4 deletions NumericKeyboard.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,24 @@

Pod::Spec.new do |s|
s.name = 'NumericKeyboard'
s.version = '1.4.0'
s.version = '1.4.1'
s.swift_version = '5.0'
s.summary = 'NumericKeyboard is a input view for UITextField & UITextView that shows a numeric entry keyboard on iPad.'

s.description = <<-DESC
This keyboard view is intended to replace the default keyboard on iPad for entering numerical values.
As the default keyboard on iPad still shows all keys even for numerical entry modes, this keyboard only focuses on numeric keys.
This is a fork of https://github.com/marcjordant/NumericKeyboard fixing some issues with more current Xcode & Swift versions.
DESC

s.homepage = 'https://github.com/marcjordant/NumericKeyboard'
s.homepage = 'https://github.com/Sevyls/NumericKeyboard'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'Marc Jordant' => '[email protected]' }
s.source = { :git => 'https://github.com/marcjordant/NumericKeyboard.git', :tag => s.version.to_s }
s.source = { git: 'https://github.com/Sevyls/NumericKeyboard.git', tag: s.version.to_s }
s.screenshots = 'https://github.com/marcjordant/NumericKeyboard/blob/master/example.png?raw=true'
s.social_media_url = 'https://twitter.com/marcjordant'

s.ios.deployment_target = '8.0'
s.ios.deployment_target = '11.4'

s.source_files = 'NumericKeyboard/Classes/**/*'

Expand Down
18 changes: 9 additions & 9 deletions NumericKeyboard/Classes/NKInputView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ open class NKInputView: UIView, UIInputViewAudioFeedback
- important:
Only affect the input view on iPad. Do nothing on iPhone or iPod
*/
@discardableResult open static func with(_ textView: UITextInput,
@discardableResult public static func with(_ textView: UITextInput,
type: NKKeyboardType = .decimalPad,
returnKeyType: NKKeyboardReturnKeyType = .default) -> NKInputView?
{
Expand Down Expand Up @@ -251,7 +251,7 @@ open class NKInputView: UIView, UIInputViewAudioFeedback

button?.returnType = .custom(text: title, actionButton: true)
button?.isHidden = false
button?.addTarget(self, action: #selector(NKInputView.additionalButtonTouched(sender:)), for: UIControlEvents.touchUpInside)
button?.addTarget(self, action: #selector(NKInputView.additionalButtonTouched(sender:)), for: UIControl.Event.touchUpInside)
}

/**
Expand All @@ -275,7 +275,7 @@ open class NKInputView: UIView, UIInputViewAudioFeedback
}

button?.isHidden = true
button?.removeTarget(nil, action: nil, for: UIControlEvents.touchUpInside)
button?.removeTarget(nil, action: nil, for: UIControl.Event.touchUpInside)
}


Expand Down Expand Up @@ -309,7 +309,7 @@ open class NKInputView: UIView, UIInputViewAudioFeedback
bDot.isHidden = true
}

bDot.setTitle((Locale.current as NSLocale).object(forKey: NSLocale.Key.decimalSeparator) as? String, for: UIControlState.normal)
bDot.setTitle((Locale.current as NSLocale).object(forKey: NSLocale.Key.decimalSeparator) as? String, for: UIControl.State.normal)
}

// Remove the Undo/Redo toolbar
Expand Down Expand Up @@ -373,20 +373,20 @@ open class NKInputView: UIView, UIInputViewAudioFeedback
textView?.insertText(char)

if isTextField() {
NotificationCenter.default.post(name: NSNotification.Name.UITextFieldTextDidChange, object: self.textView)
NotificationCenter.default.post(name: UITextField.textDidChangeNotification, object: self.textView)
}
else if isTextView() {
NotificationCenter.default.post(name: NSNotification.Name.UITextViewTextDidChange, object: self.textView)
NotificationCenter.default.post(name: UITextField.textDidChangeNotification, object: self.textView)
}

case TAG_B_BACKWARD:
textView?.deleteBackward()

if isTextField() {
NotificationCenter.default.post(name: NSNotification.Name.UITextFieldTextDidChange, object: self.textView)
NotificationCenter.default.post(name: UITextField.textDidChangeNotification, object: self.textView)
}
else if isTextView() {
NotificationCenter.default.post(name: NSNotification.Name.UITextViewTextDidChange, object: self.textView)
NotificationCenter.default.post(name: UITextField.textDidChangeNotification, object: self.textView)
}

case TAG_B_RETURN:
Expand All @@ -396,7 +396,7 @@ open class NKInputView: UIView, UIInputViewAudioFeedback
}
else if isTextView() {
textView?.insertText("\n")
NotificationCenter.default.post(name: NSNotification.Name.UITextViewTextDidChange, object: self.textView)
NotificationCenter.default.post(name: UITextField.textDidChangeNotification, object: self.textView)
}

case TAG_B_DISMISS:
Expand Down
4 changes: 2 additions & 2 deletions NumericKeyboard/Classes/NKKeyboardButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class NKKeyboardButton: UIButton

var returnType = NKInputView.NKKeyboardReturnKeyType.default {
didSet {
self.setTitle(returnType.text(), for: UIControlState())
self.setTitleColor(returnType.textColor() ?? UIColor.black, for: UIControlState.normal)
self.setTitle(returnType.text(), for: UIControl.State())
self.setTitleColor(returnType.textColor() ?? UIColor.black, for: UIControl.State.normal)
self.backgroundColor = returnType.backgroundColor() ?? backgroundColorForStateNormal
}
}
Expand Down