2020年12月21日星期一

How to insert user entered data into a local html document

I'm very new to Swift and I'm struggling a bit with a simple task. I have made a simple app which will launch a local HTML file.

I now want to add a text box that appears, asking the user "Enter IP address". Then, that text will be inserted into the HTML file in 3 different places.

Does anyone have any ideas on this? Or know of a good site which might have some tutorials which relate to this idea? Here's my code so far:

import UIKit  import WebKit    class ViewController: UIViewController {        @IBOutlet weak var htmlload: WKWebView!      override func viewDidLoad() {          super.viewDidLoad()          // Do any additional setup after loading the view, typically from a nib.                    let htmlpath = Bundle.main.path(forResource: "index", ofType: "html")          let url = URL(fileURLWithPath: htmlpath!)          let request = URLRequest(url: url)          htmlload.load(request)      }        override func didReceiveMemoryWarning() {          super.didReceiveMemoryWarning()          // Dispose of any resources that can be recreated.      }  }  
https://stackoverflow.com/questions/65401686/how-to-insert-user-entered-data-into-a-local-html-document December 22, 2020 at 08:15AM

没有评论:

发表评论