# NoCaretUITextField

    class NoCaretUITextField : UITextField

Class overriding a UITextField in order to hide the caret and cancel edit actions. Used for read-only text fields with no default actions.

- `caretRect(for:)`

  Returns a rectangle to draw the caret at a specified insertion point. Used here to hide the caret by returning a Zero CGRect.

  #### Declaration

  Swift

      override func caretRect(for position: UITextPosition) -> CGRect

  #### Parameters

  `position` | An object that identifies a location in a text input area.

  #### Return Value

  A rectangle that defines the area for drawing the caret.

- `selectionRects(for:)`

  Returns an array of selection rects corresponding to the range of text. Used here to hide text selection by returning an empty array

  #### Declaration

  Swift

      override func selectionRects(for range: UITextRange) -> [UITextSelectionRect]

  #### Parameters

  `range` | An object representing a range in a document’s text.

  #### Return Value

  An array of UITextSelectionRect objects that encompass the selection.

- `canPerformAction(_:withSender:)`

  Requests the receiving responder to enable or disable the specified command in the user interface. Always returns false here so no actions are performable on this control

  #### Declaration

  Swift

      override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool

  #### Parameters

  `action` | A selector that identifies a method associated with a command.
  `sender` | The object calling this method.

  #### Return Value

  true if the command identified by action should be enabled or false if it should be disabled.

Copyright (c) 2018-2024, AB Circle Ltd. All rights reserved.

Generated by jazzy ♪♫ v0.14.3, a Realm project.