顯示具有 Apple 標籤的文章。 顯示所有文章
顯示具有 Apple 標籤的文章。 顯示所有文章

2014年6月30日 星期一

Swift Language - The Basics

Swift 是 2014年 WWDC Apple 發佈的新語言,可想而知,未來在 iOS/OS X 上開發程式,Swift 是必學的程式語言。Apple 網站上已有相關的文件可參考,電子書可從App Store下載(Swift 系列已經有兩集:第一集 The Swift Programming Language,第二集 Using Swift with Cocoa and Objective-C) 想加入 iOS/OS X App 開發嗎?快來學習吧!

基本語法介紹

let name = "Book"
var money = 100

使用 let 來宣告常數(Constants); 使用 var 來宣告變數(Variables)。
Swift 會自動推導常數或變數的型別,所以 name 它知道是 String,而 money 是 Int。

不過你也可以直接告訴 Swift 你要宣告什麼型別(這語法英文翻成 Type annotation)

var city: String

也可以使用 Unicode 字元來當做常數或變數

var 問候 = "你好"

println(問候)
// prints "問候"

2013年6月12日 星期三

Cocoa Objective-C Hierarchy for Foundation

學習物件導向程式時,其實也是在學習怎麼利用現有的物件,來實現你想要做的事。就如同在寫程序導向語言,像 C 這一類的程式時,我們也習慣會去找看看是否有現成的函式庫可用,而不需要再重新發明輪子。所以,要怎麼知道或找到現成的物件來用,我覺得是很重要的一件事!

Cocoa 和 Cocoa Touch 提供的 frameworks 何其多?想要了解就是多寫多用而已。Foundation Framework 是最基礎的一個,也許可以從這個 framework 開始深入。

在 Apple 官方網站裡已經有提供我想知道的資料,「所有在 Foundation Framework 裡的物件」。

藍色的部份是 iOS 和 OS X 都有的;而灰色的部份只有 OS X 才有。



2012年12月7日 星期五

GCC option on Mac : -framework

之前在 FFmpeg tutorial on Mac OS X - tutorial01 中有提到,在 Mac 上編譯時會需要某些函式庫的東西,我們可以利用 -framework 這個 GCC 選項來加入我們所需要的函式庫,那時使用時,還不太了解它的作用。今天找到了它的使用說明,原來在 Apple Developer 的網站上有寫:


gcc(1) OS X Developer Tools Manual Page

       In addition to the options listed below, Apple's GCC also accepts and passes nearly all of the
       options defined by the linker ld and by the library tool libtool.  Common options include -framework,
       -dynamic, -bundle, -flat_namespace, and so forth.  See the ld and libtool man pages for further
       details.



ld(1) OS X Developer Tools Manual Page

-framework name[,suffix]
        This option tells the linker to search for `name.framework/name' the framework search path.
        If the optional suffix is specified the framework is first searched for the name with the
        suffix and then without (e.g. look for `name.framework/name_suffix' first, if not there try
        `name.framework/name').

看來 Apple Developer 要常去呀!

2012年10月11日 星期四

Keynote 模擬毛筆畫的功能

前言

我是 Keynote 的新手,所以一開始並不知有這種功能。一開始是從某個網站看到一張畫得非常棒的說明圖片,A successful Git branching model

除了作者詳細的說明之外,就是這張說明圖片吸引了我的注意,很好奇這是用什麼做成的?後來在討論區有人回答是"Keynote",才讓我試著去學怎麼畫出這樣的圖片來。