I want to disable copying text of my html file that is displayed in a WebKit View. Here is my WebKit View code:
@IBOutlet weak var webView: WKWebView!
@IBOutlet weak var backgroundView: UIView!
var index = 0
var fileName = ""
override func viewDidLoad() {
super.viewDidLoad()
loadSubject()
// Load the appropriate file
let htmlPath = Bundle.main.path(forResource: fileName, ofType: "htm")
let url = URL(fileURLWithPath: htmlPath!)
let request = URLRequest(url: url)
webView.load(request)
}
I'm trying to find a solution and here's the closest one, but I'm not sure how to implement this if it is even the correct answer for me: Prevent user from copying text on browsers
I've been using Swift and Xcode for about 6 months, but I'm brand new to HTML and WebKit View, so I apologize if this is something simple.
Thanks!