I am trying to add a UITextView within my app to output data to. Naturally the data will eventually be bigger than the size of the UITextView, and the view is a set size. So I would like the user to be able to scroll through its content.
However, I cannot scroll through the content in the app. Am I supposed to build the scrolling function myself? Seems weird that I would have to do that, but I cannot seem to find the answer to this on the web.
I’ve also noticed that no vertical scroll at shows up when the text count is larger than the size of the object, which makes me wonder if I am missing a property or two.
func createStatusField() -> UITextView {
let myStatus = UITextView(frame: CGRect(x: 50, y: 50, width: 100, height: 300))
myStatus.autocorrectionType = .no
myStatus.text = "hello there"
myStatus.backgroundColor = .secondarySystemBackground
myStatus.textColor = .secondaryLabel
myStatus.font = UIFont.preferredFont(forTextStyle: .body)
myStatus.layer.zPosition = 1
myStatus.isScrollEnabled = true
myStatus.showsVerticalScrollIndicator = true
return myStatus
}