0

I have created a viewcontroller called communityViewController and connected it to its class with the same name. Then I added a webview in man.storyboard. How do i configure it now in the .swift file?

2 Answers2

0
class communityViewController:UIViewController {

  @IBOutlet weak var webView: UIWebView!
  override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
    let url = NSURL (string: "http://example.de/");
    let requestObj = NSURLRequest(URL: url!);
    webView.loadRequest(requestObj);
  }
}
Shahzad Barkati
  • 2,532
  • 6
  • 25
  • 33
T.Grosche
  • 16
  • 3
0

Don't forget to add in your info.plist

<dict>
   <key>NSExceptionDomains</key>
   <dict/>
   <key>NSAllowsArbitraryLoads</key>
   <true/>
   </dict>
</plist>
Osama Ibrahim
  • 995
  • 10
  • 13