Search code examples
iosswiftuitextviewcgrectuiedgeinsets

convert Swift 2.3 to Swift 4


I am new in Swift 4 and I want to resolve the Swift version 2.0 Project with Uitextview error

here is error in Swift 4

let textView = UITextView(frame: CGRectInset(view.bounds, 10, 10))

I will change with 'CGRectInset' has been replaced by instance method 'CGRect.insetBy(dx:dy:)'

but I don't know how

I change with let textView = UITextView(frame: CGRect.insetBy(view.bounds, 10, 10)) but error again

and here is other problem

textView.textContainerInset = UIEdgeInsetsZero

I will change the UIEdgeInsetsZero


Solution

  • let textView = UITextView(frame: view.bounds.insetBy(dx:10,dy:10))