SwiftによるiOSアプリ開発入門・・・その1!! 「Hello Swift」 | piceのブログ

piceのブログ

IT関係のニュース、関連情報をご紹介します。

こんばんは、piceです。


WWDC2014で発表されたApple新言語「Swift」ですが、


これからそのSwiftによるiOSアプリプログラミングに挑戦していきたいと思います。


まずはじめに「Hello Swift」、文字列を表示させるサンプルアプリです。


サンプルコードは以下のようにしました。
*****************************************
 

import UIKit

 

class ViewController: UIViewController {

                           

    override func viewDidLoad() {

        super.viewDidLoad()

        // Do any additional setup after loading the view, typically from a nib.

        var label: UILabel = UILabel()

        label.text = \"Hello Swift!!!\"

        label.sizeToFit()

        label.center = self.view.center

        self.view.addSubview(label)

    }

 

    override func didReceiveMemoryWarning() {

        super.didReceiveMemoryWarning()

        // Dispose of any resources that can be recreated.

    }

 

}


*****************************************

実行結果は以下の通りです。