I have a very simple screen.
a UITextView and UITextField.
basically, what I want to achieve is that when a user types something into the UITextField, it goes into the UITextView.
Obviously the UITextView has userInteractionEnabled : NO and it won't never show the keyboard.
To make it nicer I also wanted the cursor to be always shown (kinda matrix talking to you :-).
To achieve this i placed a little subview into the UITextView with a width of 2 and a height of 20 (enough for my font size) and the following piece of code into the viewDidLoad:
UIView.animate(withDuration: 1, delay: 0, options: .repeat, animations: {() -> Void in
self.cursorView.alpha = 0 }, completion: {(animated: Bool) -> Void in
self.cursorView.alpha = 1
})
Now, the question is: how can I dynamically move the cursorView according to the text that will be written (automaGically) into the UITextView?
Is there a way to recognise its length - position or anything else?