Mais conteúdo relacionado Semelhante a これからはじめる SwiftPlayground入門 (20) Mais de Hiramatsu Ryosuke (10) これからはじめる SwiftPlayground入門10. Swift Playground !
画像を表示させたり
var imageUrl: String = "http://img.tiqav.com/1oM.jpg"
!
var imageURL: NSURL = NSURL.URLWithString(imageUrl)
var imageData: NSData = NSData(contentsOfURL: imageURL)
!
var image: UIImage = UIImage(data: imageData)
12. Swift Playground !
UIKitの見た目のチューニングをしたり
class DataSource : NSObject, UITableViewDataSource {
func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) ->
Int {
return 3
}
func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath:
NSIndexPath!) -> UITableViewCell! {
var cell: UITableViewCell = UITableViewCell(frame: CGRectMake(0, 0, 320,
44),
reuseIdentifier: "Cell")
cell.textLabel.text = "Hello"
return cell
}
}
var tableView:UITableView = UITableView(frame: CGRectMake(0, 0, 320, 320),
style: UITableViewStyle.Plain)
var ds: DataSource = DataSource()
tableView.dataSource = ds
!
tableView.reloadData()
13. Swift Playground !
複雑な書き方を練習したり
func foo(callback:(String -> String)) -> (String -> String) {
var tempResult = callback("hello")
return { str in return tempResult + str; }
}
!!
let resultFunc = foo({str in return str.uppercaseString});
resultFunc(" WORLD");
19. 参考資料
・Appleの公式ドキュメント
・The Swift Programming Language
# プログラミング言語としての特徴の話
・Using Swift With Cocoa and Objective-C
# 既存のObjCとはどう共存するか?の話
iBooksで出ているのでiPhoneに入れて通勤中に読める
20. 参考資料
・WWDCセッションビデオ
とりあえず
・Introduction to Swift
・Swift Playgrounds
w/ ObjC
・Integrating Swift with Objective-C
発展
・Intermediate Swift
・Swift Interoperability in Depth
・Advanced Swift
23. 参考資料
・Swift Facebook ページ
・https://www.facebook.com/pages/Swift/1475908685980132
# いいね!しておくと勉強会や最新の情報が受け取れる