import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { self.window = UIWindow(frame: UIScreen.mainScreen().bounds) // Override point for customization after application launch. self.window!.backgroundColor = UIColor.whiteColor() self.window!.rootViewController = RootViewController(); self.window!.makeKeyAndVisible() return true } }
import UIKit class RootViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() let imageView = UIImageView.init(frame: UIScreen.mainScreen().bounds); imageView.backgroundColor = UIColor.greenColor() self.view.addSubview(imageView) let url:NSURL = NSURL.init(string: "http://pic2.ooopic.com/11/86/60/84bOOOPIC13.jpg")! let data:NSData = NSData(contentsOfURL: url)! let image = UIImage(data: data)! imageView.image = image } }