Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

ようこそ! Swift Playgroundsへ

15,234 views

Published on

2014/10/24に行われた【#techbuzz】第4回Swift勉強会 で発表したスライドです。

これに関係するブログ記事を書きました。
http://www.kuma-de.com/blog/2014-10-26/6830

Published in: Technology
  • DOWNLOAD THAT BOOKS/FILE INTO AVAILABLE FORMAT - (Unlimited) ......................................................................................................................... ......................................................................................................................... Download FULL PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... accessibility Books Library allowing access to top content, including thousands of title from favorite author, plus the ability to read or download a huge selection of books for your pc or smartphone within minutes Christian, Classics, Comics, Contemporary, Cookbooks, Art, Biography, Business, Chick Lit, Children's, Manga, Memoir, Music, Science, Science Fiction, Self Help, History, Horror, Humor And Comedy, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS/FILE INTO AVAILABLE FORMAT - (Unlimited) ......................................................................................................................... ......................................................................................................................... Download FULL PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... accessibility Books Library allowing access to top content, including thousands of title from favorite author, plus the ability to read or download a huge selection of books for your pc or smartphone within minutes Christian, Classics, Comics, Contemporary, Cookbooks, Art, Biography, Business, Chick Lit, Children's, Manga, Memoir, Music, Science, Science Fiction, Self Help, History, Horror, Humor And Comedy, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THI5 BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

ようこそ! Swift Playgroundsへ

  1. 1. ようこそ! Swift Playgroundsへ 2014/10/24 @【#techbuzz】第4 回Swift 勉強会
  2. 2. フロントエンドエンジニア (2008 年よりフリーランス) いろいろやっています。 Web: JavaScript, TypeScript iOS: Objective-C, Swift Flash/AIR: ActionScript3/2 ブログ http://www.kuma-de.com/ Twitter: @kinkuma_design 仕事では営業用とか教育用のツール アプリ制作が多いです あと、クリエイティブ系のセミナーを開催したりす るF-site のスタッフをやってます http://f-site.org/ ※来月11/08 に開催します(ステマ)
  3. 3. 日課管理・記録アプリ Habit Keeper AppStoreで好評発売中!! https://itunes.apple.com/jp/app/ id567646997?l=ja&mt=8 無料版もあります! https://itunes.apple.com/jp/app/ id602525022?l=ja&mt=8 おかげさまで有料+無料合わせて 5 万ダウンロードされました!
  4. 4. ここから本題 swiftちゃん
  5. 5. Swift Playgrounds って何? Xcode6 から可能になったswift の実行環境 例えたのなら? ・swift ・Cocoa (OS X) ・Cocoa Touch (iOS) の遊び場、実験ひろば
  6. 6. Swift Playgrounds って何? Playground を用意 コードを 編集 実行結果を すぐに確認 早いサイクルでコードの実験&結果確認ができる いらなくなったら気軽にゴミ箱へ
  7. 7. Swift Playgrounds って何? ・playground ファイル単体で ・プロジェクトに追加する形で どちらでも実行可能 コードを書いているときにちょっと試してみたいことを、 プロジェクトに直接記述せずに 気軽に確認+実験ができる!!
  8. 8. Swift Playgrounds って何? こんなときに便利! 文法の書き方 swift で配列の書き方ってどうやるんだっけ? あれ?let やvar の違いって? ? プレビュー UITableViewCell ってどんなタイプがあるんだっけ? UIColor のこの色ってどんな色? インスタンスのプロパティの中身って? ? ?
  9. 9. 大まかな機能は3 種類 The Timeline 値をキャプチャしてグラフ化 Quick Looks プレビュー+値出力 XCPlayground Apple 製のPlaygrounds 用のモジュール (追加機能みたいなもの。使わなくてもOK)
  10. 10. The Timeline swiftちゃん
  11. 11. The Timeline 値をキャプチャしてグラフ化
  12. 12. The Timeline 右下のスライダを動かすとグラフ上の値が確認できる
  13. 13. The Timeline デモ
  14. 14. Quick Looks swiftちゃん
  15. 15. Quick Looks プレビュー+値出力 いろんなものをその場で確認できる ・色 ・文字列 ・画像 ・ビュー(UIView) ・配列+辞書 ・Points, rects, sizes ・ベジェパス ・URL ・クラスと構造体 などなど
  16. 16. Quick Looks 表示できるタイプ一覧 Operating System Types Supporting debugQuickLookObject https://developer.apple.com/library/IOs/documentation/IDEs/Conceptual/CustomClassDisplay_in_QuickLook/CH02-std_ objects_support/CH02-std_objects_support.html#//apple_ref/doc/uid/TP40014001-CH3-SW1 またQuick Looks はどんな風に見せるのか カスタマイズも可能 About Variables Quick Look for Custom Types https://developer.apple.com/library/IOs/documentation/IDEs/Conceptual/CustomClassDisplay_in_QuickLook/Introduction/ Introduction.html Swift: Adding custom quick look to your classes http://ericasadun.com/2014/06/26/swift-adding-custom-quick-look-to-your-classes/
  17. 17. Playground への画像の追加方法 View > Utitilities > Show File Inspector Playground Settings の矢印を クリックしてFinder の中を開く そこに追加すればOK
  18. 18. Quick Looks デモ
  19. 19. XCPlayground swiftちゃん
  20. 20. XCPlayground Apple 製のPlaygrounds 用のモジュール ・XCPCaptureValue 手動での値キャプチャ ・XCPShowView ライブビュー ・XCPSetExecutionShouldContinueIndefinitely 非同期実行
  21. 21. XCPlayground 使う前に、上のところに import XCPlayground と書いておく
  22. 22. XCPCaptureValue 手動での値キャプチャ func XCPCaptureValue<T>(identifier: String, value: T) identifierでひとつのグラフにすることができる 自動だと、値の流れがぶつ切りなってしまうところも つなげることができるようになる。
  23. 23. XCPCaptureValue import UIKit import XCPlayground //XCPCaptureValue // 手動で値をとった場合 let selfCapId = "manual_capture" var n = 0 n = 800 XCPCaptureValue(selfCapId, n) n = 30 XCPCaptureValue(selfCapId, n) for i in 0 ... 30{ n += i if n % 3 == 0 { XCPCaptureValue(selfCapId, n) } }
  24. 24. XCPShowView SpriteKit やView のアニメーションを Playground で確認できる ただし、Xcode6.0.1 の時点ではUIView は未対応。 OSX のNSView は対応している。 Xcode6.1 ではUIView の対応ができているらしい(未確認) -> Xcode6.1 がリリースされて対応が確認できました。 File Inspector のRun in Full Simulator を有効にする必要あり
  25. 25. XCPShowView import UIKit import XCPlayground // アニメーション //Run in Full Simulator を有効にする必要あり var animContainerView = UIView(frame: CGRectMake(0, 0, 300, 300)) XCPShowView("animationView", animContainerView) var animView = UIView(frame: CGRectMake(0, 0, 30, 30)) animView.backgroundColor = UIColor.blueColor() animContainerView.addSubview(animView) UIView.animateWithDuration(1.0 , animations: { () -> Void in var pos = animView.frame.origin pos.x = 230 pos.y = 230 animView.frame.origin = pos }, completion: { (success:Bool) -> Void in println("complete!!") })
  26. 26. XCPSetExecutionShouldContinueIndefinitely 非同期実行 func XCPSetExecutionShouldContinueIndefinitely(conti nueIndefinitely: Bool = default) (関数名長い!) 普通は上からプログラムを順番に実行してその場で終わってしま うが、時間のかかる処理を待つことができる
  27. 27. XCPSetExecutionShouldContinueIndefinitely import UIKit import XCPlayground class SampleTimer{ ... 省略 func startTimer(){ stopTimer() timer = NSTimer.scheduledTimerWithTimeInterval(1.0, target: self, selector: "onTimerTick", userInfo: nil, repeats: true) } ... 省略 } XCPSetExecutionShouldContinueIndefinitely(continueIndefinitely: true) let timer = SampleTimer() timer.startTimer()
  28. 28. XCPlayground デモ
  29. 29. 注意事項+まとめ swiftちゃん
  30. 30. 気をつけること パフォーマンステストには用いないようにする やりたいときはXCTest を利用する (WWDC2014 Swift Playgrounds より)
  31. 31. 今はできないこと(制限事項) ・ユーザーインタラクション(マウスとかタッチとか) ・Entitlements(Push Notifications とかのあたり) ・実機での実行 ・自作のFramework (WWDC2014 Swift Playgrounds より)
  32. 32. まとめ 書いたものがすぐに実行できる Playground は便利! ファイル1 枚で完結するので気軽に作ろう! 文の書き方やロジックなど、 気になるところはすぐ試そう! P P P
  33. 33. 参考リンク WWDC2014 Swift Playgrounds https://developer.apple.com/videos/wwdc/2014/ XCPlayground Module Reference https://developer.apple.com/library/ios/documentation/Swift/Reference/Playground_Ref/Chapters/XCPlayground.html [Swift] グラフもレンダリングもイケる! Playgroud が超絶便利! http://www.dorapro.co.jp/engineerblog/?p=137
  34. 34. ありがとう ございました! swiftちゃん

×