Just a Computer Graphics Studio & My Life

[Swift] Xcode 6 beta 初體驗

實在迫不及待想要玩Apple發佈的新程式語言「Swift」,就如同Swift的意思是「迅速」,開發者當然也要有著想要迅速學習成長的心,於是在付費開發者帳號中下載Xcode 6 beta來把玩一下~

由於黑皮棉MacBook Air只有70GB(50GB割給Windows 7),所以只好花時間挪出6GB以上的空間來安裝Xcode 6 beta~

Xcode 6 beta

看了模擬器種類,就可以推測即將發表的iPhone和iPad長什麼樣子,Resizable也真夠耐人尋味:D~

這裡還沒開始撰寫Swift,只是開個新專案,看它語法長什麼樣子,未來要換個習慣來寫APP囉~

/**
 Theme: Xcode 6 beta with Swift
 IDE: Xcode 5
 Language: Swift
 Date: 103/06/07
 Author: HappyMan
 Blog: https://cg2010studio.wordpress.com/
 */

//AppDelegate.swift
import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
        // Override point for customization after application launch.
        return true
    }

    func applicationWillResignActive(application: UIApplication) {
        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
    }

    func applicationDidEnterBackground(application: UIApplication) {
        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    }

    func applicationWillEnterForeground(application: UIApplication) {
        // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
    }

    func applicationDidBecomeActive(application: UIApplication) {
        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    }

    func applicationWillTerminate(application: UIApplication) {
        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    }

}
//ViewController.swift
import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}

Main.storyboard我先拉UILabel和UIButton來見見大家~

Xcode 6 beta xib

編譯執行在實機的樣子:

Xcode 6 beta run

螢幕的大小和設計的大小不一樣呢~

可以慢慢玩囉~想學可以參考Apple在iBook上特別推出的免費電子書,大概看了一下有800多頁

蘋果軟體工程副總裁Craig Federighi表示,蘋果希望以Swift來取代Objective-C與Python等程式語言。」雖然不知道要經過幾年的時間,不過還是趁早學會Swift吧!也期望自己coding能力可以更快(學習成長)狠(瞄準目標)準(豐富收獲)

參考:

廣告

發表留言

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

您的留言將使用 WordPress.com 帳號。 登出 / 變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 / 變更 )

Facebook照片

您的留言將使用 Facebook 帳號。 登出 / 變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 / 變更 )

連結到 %s

標籤雲

%d 位部落客按了讚: