Skip to content

Instantly share code, notes, and snippets.

@felipegenuino
Created December 30, 2015 02:51
Show Gist options
  • Save felipegenuino/5ed42e5102fc7c328d7d to your computer and use it in GitHub Desktop.
Save felipegenuino/5ed42e5102fc7c328d7d to your computer and use it in GitHub Desktop.
//
// ViewController.swift
// baixando-conteudo-da-web
//
// Created by Felipe Genuino on 29/12/15.
// Copyright © 2015 Felipe Genuino. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
//precisa criar um webview e arrastar para o storyboard
@IBOutlet var webView: UIWebView!
override func viewDidLoad() {
super.viewDidLoad()
let url = NSURL(string: "http://maisengenharia.altoqi.com.br/")!
webView.loadRequest(NSURLRequest(URL: url))
/*
let task = NSURLSession.sharedSession().dataTaskWithURL(url) { (data, response, error) -> Void in
if let urlContent = data {
let webContent = NSString(data: urlContent, encoding: NSUTF8StringEncoding)
dispatch_async(dispatch_get_main_queue(), { () -> Void in
self.webView.loadHTMLString(String(webContent), baseURL: nil)
})
}else{
}
}
task.resume()
*/
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment