DEV Community

D
D

Posted on

Swift で Hello World

とりあえずSwiftでHello World書いてみた。
5GBもするXcode 6 betaをダウンロードしてインストール
起動するのに1分ぐらいかかる。

AppDelegate.swift

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { self.window = UIWindow(frame: UIScreen.mainScreen().bounds) // Override point for customization after application launch. var controller: UIViewController = UIViewController() var view = UIView(frame: CGRectMake(0, 0, 320, 568)) view.backgroundColor = UIColor.blackColor() controller.view = view var label: UILabel = UILabel(frame: CGRectMake(0, 0, 320, 20)) label.center = CGPointMake(160, 284) label.textAlignment = NSTextAlignment.Center label.text = "Hello World ! Hello Swift !" label.textColor = UIColor.whiteColor() controller.view.addSubview(label) self.window!.rootViewController = controller self.window!.backgroundColor = UIColor.whiteColor() self.window!.makeKeyAndVisible() return true } 
Enter fullscreen mode Exit fullscreen mode

プロジェクは、github (https://github.com/dongri/swift)

Top comments (0)