InputBarAccessoryView+Availability.swift 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //
  2. // InputBarAccessoryView+Availability.swift
  3. // InputBarAccessoryView
  4. //
  5. // Copyright © 2017-2019 Nathan Tannar.
  6. //
  7. // Permission is hereby granted, free of charge, to any person obtaining a copy
  8. // of this software and associated documentation files (the "Software"), to deal
  9. // in the Software without restriction, including without limitation the rights
  10. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. // copies of the Software, and to permit persons to whom the Software is
  12. // furnished to do so, subject to the following conditions:
  13. //
  14. // The above copyright notice and this permission notice shall be included in all
  15. // copies or substantial portions of the Software.
  16. //
  17. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  23. // SOFTWARE.
  24. //
  25. // Created by Nathan Tannar on 2/12/17.
  26. //
  27. import UIKit
  28. @available(*, deprecated, message: "InputManager has been renamed to InputPlugin")
  29. public typealias InputManager = InputPlugin
  30. extension InputPlugin {
  31. @available(*, deprecated, message: "`handleInput(object:)` should return a `Bool` if handle was successful or now")
  32. func handleInput(of object: AnyObject) {
  33. _ = self.handleInput(of: object)
  34. }
  35. }
  36. extension AutocompleteCompletion {
  37. // An optional string to display instead of `text`, for example emojis
  38. @available(*, deprecated, message: "`displayText` should no longer be used, use `context: [String: Any]` instead")
  39. public var displayText: String? {
  40. return text
  41. }
  42. }
  43. extension AutocompleteManager {
  44. /// If the autocomplete matches should be made by casting the strings to lowercase.
  45. /// Default value is `FALSE`
  46. /// DEPRICATED; will always return `FALSE`
  47. @available(*, deprecated, message: "`isCaseSensitive` was replaced in favour of a more customizable `filterBlock: (String) -> (Bool)`")
  48. public var isCaseSensitive: Bool {
  49. get { return false }
  50. set {
  51. if isCaseSensitive {
  52. filterBlock = { session, completion in
  53. completion.text.contains(session.filter)
  54. }
  55. } else {
  56. filterBlock = { session, completion in completion.text.lowercased().contains(session.filter.lowercased())
  57. }
  58. }
  59. }
  60. }
  61. }
  62. extension InputBarAccessoryView {
  63. /**
  64. The anchor constants used by the InputStackView
  65. ````
  66. V:|...-(padding.top)-(textViewPadding.top)-[InputTextView]-(textViewPadding.bottom)-[InputStackView.bottom]-...|
  67. H:|...-[InputStackView.left]-(textViewPadding.left)-[InputTextView]-(textViewPadding.right)-[InputStackView.right]-...|
  68. ````
  69. */
  70. @available(*, deprecated, message: "The `InputTextView` now resides in the `middleContentView` and thus this property has been renamed to `middleContentViewPadding`")
  71. public var textViewPadding: UIEdgeInsets {
  72. get {
  73. return middleContentViewPadding
  74. }
  75. set {
  76. middleContentViewPadding = newValue
  77. }
  78. }
  79. }