Your SlideShare is downloading. ×
0
RubyMotionで iOS開発2013/04/27【豊橋】第1回iPhoneアプリ開発勉強会加藤匡邦 (エアーズ株式会社)
自己紹介@mackatoMr. kato (bruce lee) in Green Hornet.
fromHamamatsu!Original Update by hirotomo
エアーズ株式会社毎日つかえるアプリを作る
Hi-Cube浜松本社
TokyoofficeinTSUKIJI※写真はイメージですOriginal Update by graney
ウェブ開発RubyonRails
おいしいはiPhoneが覚えてる
お財布はスリムに、お店はスマートに
WWDC2012attendee
WWDC2013sellsoutin2minutes!
Hamamatsu.rb#1Hamamatsu.rb2011.03.09∼
HamackathonHamackathon#2 Mobile - 2010.12.04Hamackathon
JAWS-UG浜松http://jaws-ug.jp/bc/hamamatsu/
Ruby
Rubyオブジェクト指向シンプルな文法動的な型付け
Web開発サーバー管理パッケージ管理
RubyMotion
RubyMotionRubyで書けるiOSネイティブiOSライブラリが使える
$199.99有料です
¥20,513アベノミクス2013/4/27現在
WritewithRubyclass AppDelegatedef application(application, didFinishLaunchingWithOptions:launchOptions)@window = UIWindow....
UsePowerofRubyclass AppDelegatedef application(application, didFinishLaunchingWithOptions:launchOptions)@window = UIWindow...
Metaprogramminghttp://clayallsopp.com/posts/rubymotion-metaprogramming/def tableView(tableView,didSelectRowAtIndexPath:ind...
HelloMotion% motion create HelloMotionCreate HelloMotionCreate HelloMotion/.gitignoreCreate HelloMotion/RakefileCreate Hel...
GoodbyeXcodeHelloMotion/"## Rakefile"## app$   %## app_delegate.rb"## resources$   %## Default-568h@2x.png%## spec%## main...
RunApplication% rakeBuild ./build/iPhoneSimulator-6.1-DevelopmentCompile ./app/app_delegate.rbCreate ./build/iPhoneSimulat...
REPL-interactiveconsole% rakeBuild ./build/iPhoneSimulator-6.1-DevelopmentCompile ./app/app_delegate.rbLink ./build/iPhone...
motion-cocoapodsRakefile#  -­‐*-­‐  coding:  utf-­‐8  -­‐*-­‐$:.unshift("/Library/RubyMotion/lib")require  motion/projectr...
BundlerRakefile#  -­‐*-­‐  coding:  utf-­‐8  -­‐*-­‐$:.unshift("/Library/RubyMotion/lib")require  motion/projectrequire  b...
BubbleWrap# Uses the front cameraBW::Device.camera.front.picture(media_types: [:movie, :image]) do |result|image_view = UI...
Sugarcube0xffffff.uicolor  #  =>  UIColor.colorWithRed(1.0,  green:1.0,  blue:1.0,  alpha:1.0)5.days.ago    #  =>  2012-­‐...
In therealworldEverClipWinnerofEvernoteDevCup2012!Basecamp37signalsproducthttp://www.rubymotion.com/apps/
CommunityRubyMotionもくもく会次回 2013/05/22RubyMotionKaigi20132013/05/29
BooksRubyMotion RubyMotion入門@clayallsopp @naoya_ito
SeealsoRubyMotionDeveloperCenterhttp://www.rubymotion.com/developer-center/RubyMotionJPhttp://rubymotion.jp/RubyMotionWrap...
ConclusionRubyが書けてiOS未経験の方にはお薦めRubyMotion以外にRuby使わない人には??xcodeprojが無いので共同作業はしやすい
Thanks!2013/05/819:00∼Hamamatsu.rb#27参加者募集中!http://atnd.org/events/38863
Upcoming SlideShare
Loading in...5
×

RubyMotionでiOS開発

3,341

Published on

【豊橋】第1回 iPhoneアプリ開発勉強会でLTしたときの資料です

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,341
On Slideshare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
6
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Transcript of "RubyMotionでiOS開発"

  1. 1. RubyMotionで iOS開発2013/04/27【豊橋】第1回iPhoneアプリ開発勉強会加藤匡邦 (エアーズ株式会社)
  2. 2. 自己紹介@mackatoMr. kato (bruce lee) in Green Hornet.
  3. 3. fromHamamatsu!Original Update by hirotomo
  4. 4. エアーズ株式会社毎日つかえるアプリを作る
  5. 5. Hi-Cube浜松本社
  6. 6. TokyoofficeinTSUKIJI※写真はイメージですOriginal Update by graney
  7. 7. ウェブ開発RubyonRails
  8. 8. おいしいはiPhoneが覚えてる
  9. 9. お財布はスリムに、お店はスマートに
  10. 10. WWDC2012attendee
  11. 11. WWDC2013sellsoutin2minutes!
  12. 12. Hamamatsu.rb#1Hamamatsu.rb2011.03.09∼
  13. 13. HamackathonHamackathon#2 Mobile - 2010.12.04Hamackathon
  14. 14. JAWS-UG浜松http://jaws-ug.jp/bc/hamamatsu/
  15. 15. Ruby
  16. 16. Rubyオブジェクト指向シンプルな文法動的な型付け
  17. 17. Web開発サーバー管理パッケージ管理
  18. 18. RubyMotion
  19. 19. RubyMotionRubyで書けるiOSネイティブiOSライブラリが使える
  20. 20. $199.99有料です
  21. 21. ¥20,513アベノミクス2013/4/27現在
  22. 22. WritewithRubyclass AppDelegatedef application(application, didFinishLaunchingWithOptions:launchOptions)@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)@window.makeKeyAndVisible@blue_view = UIView.alloc.initWithFrame(CGRectMake(10, 10, 100, 100))@blue_view.backgroundColor = UIColor.blueColor@window.addSubview(@blue_view)trueendendapp_delegate.rb
  23. 23. UsePowerofRubyclass AppDelegatedef application(application, didFinishLaunchingWithOptions:launchOptions)@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)@window.makeKeyAndVisible %w(blue-lagoon red-ocean black-coffee).each_with_index do |str, i|UIView.alloc.init.tap do |view|view.frame = [[50 * i, 50 * i + 20], [100, 100]]view.backgroundColor = UIColor.send(:"#{$1}Color")@window.addSubview(view)end if str =~ /^(?!black)(w+)-.+/end trueendendapp_delegate.rb
  24. 24. Metaprogramminghttp://clayallsopp.com/posts/rubymotion-metaprogramming/def tableView(tableView,didSelectRowAtIndexPath:indexPath)menu_row = self.menu_items[indexPath.row]# => profileself.send("open_#{menu_row}")enddef open_profile; #...; enddef open_messages; #...; enddef open_feed; # ...; endclass Profile# EX: has_one :userdef self.has_one(name)klass = make_klass_from_name(name)# EX: => User# Effect: (a_profile.user = a_user)# === a_user.profile_id = 4define_method("#{name}=") do |value|value.send("#{self.class.stringify}_id=", self.id)value.savevalueendenddef self.stringify; "profile"; endendsend define_method
  25. 25. HelloMotion% motion create HelloMotionCreate HelloMotionCreate HelloMotion/.gitignoreCreate HelloMotion/RakefileCreate HelloMotion/appCreate HelloMotion/app/app_delegate.rbCreate HelloMotion/resourcesCreate HelloMotion/resources/Default-568h@2x.pngCreate HelloMotion/specCreate HelloMotion/spec/main_spec.rb
  26. 26. GoodbyeXcodeHelloMotion/"## Rakefile"## app$   %## app_delegate.rb"## resources$   %## Default-568h@2x.png%## spec%## main_spec.rbGoodbyeXcode/"## GoodbyeXcode$   "## Default-568h@2x.png$   "## Default.png$   "## Default@2x.png$   "## GXAppDelegate.h$   "## GXAppDelegate.m$   "## GoodbyeXcode-Info.plist$   "## GoodbyeXcode-Prefix.pch$   "## en.lproj$   $   %## InfoPlist.strings$   %## main.m"## GoodbyeXcode.xcodeproj$   "## project.pbxproj$   "## project.xcworkspace$   $   "## contents.xcworkspacedata$   $   %## xcuserdata$   $   %## kato.xcuserdatad$   $   %## UserInterfaceState.xcuserstate$   %## xcuserdata$   %## kato.xcuserdatad$   %## xcschemes$   "## GoodbyeXcode.xcscheme$   %## xcschememanagement.plist%## GoodbyeXcodeTests"## GoodbyeXcodeTests-Info.plist"## GoodbyeXcodeTests.h"## GoodbyeXcodeTests.m%## en.lproj%## InfoPlist.strings
  27. 27. RunApplication% rakeBuild ./build/iPhoneSimulator-6.1-DevelopmentCompile ./app/app_delegate.rbCreate ./build/iPhoneSimulator-6.1-Development/HelloMotion.appLink ./build/iPhoneSimulator-6.1-Development/HelloMotion.app/HelloMotionCreate ./build/iPhoneSimulator-6.1-Development/HelloMotion.app/Info.plistCreate ./build/iPhoneSimulator-6.1-Development/HelloMotion.app/PkgInfoCopy ./resources/Default-568h@2x.pngCreate ./build/iPhoneSimulator-6.1-Development/HelloMotion.dSYMwarning: no debug symbols in executable (-arch i386)Simulate ./build/iPhoneSimulator-6.1-Development/HelloMotion.app(main)>
  28. 28. REPL-interactiveconsole% rakeBuild ./build/iPhoneSimulator-6.1-DevelopmentCompile ./app/app_delegate.rbLink ./build/iPhoneSimulator-6.1-Development/HelloMotion.app/HelloMotionCreate ./build/iPhoneSimulator-6.1-Development/HelloMotion.app/Info.plistCreate ./build/iPhoneSimulator-6.1-Development/HelloMotion.app/PkgInfoCreate ./build/iPhoneSimulator-6.1-Development/HelloMotion.dSYMSimulate ./build/iPhoneSimulator-6.1-Development/HelloMotion.app(main)> 2013-04-27 15:31:48.161 HelloMotion[1990:c07] Application windows ...(main)> self=> main(#<UIView:0x7648df0>)> self.backgroundColor = UIColor.whiteColor=> #<UICachedDeviceWhiteColor:0xa96f180>(#<UIView:0x7648df0>)>
  29. 29. motion-cocoapodsRakefile#  -­‐*-­‐  coding:  utf-­‐8  -­‐*-­‐$:.unshift("/Library/RubyMotion/lib")require  motion/projectrequire  rubygemsrequire  motion-­‐cocoapods  Motion::Project::App.setup  do  |app|    #  Use  `rake  config  to  see  complete  project  settings.    app.name  =  HelloMotion      app.pods  do        pod  JSONKit    endend
  30. 30. BundlerRakefile#  -­‐*-­‐  coding:  utf-­‐8  -­‐*-­‐$:.unshift("/Library/RubyMotion/lib")require  motion/projectrequire  bundlerBundler.require  Motion::Project::App.setup  do  |app|    #  Use  `rake  config  to  see  complete  project  settings.    app.name  =  HelloMotion      app.pods  do        pod  JSONKit    endendGemfilesource  https://rubygems.org  gem  rakegem  motion-­‐cocoapodsgem  bubble-­‐wrapgem  sugarcube
  31. 31. BubbleWrap# Uses the front cameraBW::Device.camera.front.picture(media_types: [:movie, :image]) do |result|image_view = UIImageView.alloc.initWithImage(result[:original_image])endCameraBW::Location.get do |result|p "From Lat #{result[:from].latitude}, Long #{result[:from].longitude}"p "To Lat #{result[:to].latitude}, Long #{result[:to].longitude}"endLocationBW::HTTP.get("https://api.github.com/users/mattetti") do |response|p response.body.to_strendHTTP
  32. 32. Sugarcube0xffffff.uicolor  #  =>  UIColor.colorWithRed(1.0,  green:1.0,  blue:1.0,  alpha:1.0)5.days.ago    #  =>  2012-­‐12-­‐29  11:42:24  -­‐0700Fixnum#  UIApplication.sharedApplication.openURL(NSURL.URLWithString("https://github.com"))"https://github.com".nsurl.openNSURL#  UIImage  from  name"my_image".uiimage    #  =>  UIImage.imageNamed("my_image")#  UIFont  from  name"my_font".uifont(20)  #  =>  UIFont.fontWithName("my_font",  size:20)#  NSLocalizedString  from  string"hello".localized    #  =>  NSBundle.mainBundle.localizedStringForKey("hello",  value:nil,  table:nil)"hello"._                    #  ==  "hello".localizedNSString
  33. 33. In therealworldEverClipWinnerofEvernoteDevCup2012!Basecamp37signalsproducthttp://www.rubymotion.com/apps/
  34. 34. CommunityRubyMotionもくもく会次回 2013/05/22RubyMotionKaigi20132013/05/29
  35. 35. BooksRubyMotion RubyMotion入門@clayallsopp @naoya_ito
  36. 36. SeealsoRubyMotionDeveloperCenterhttp://www.rubymotion.com/developer-center/RubyMotionJPhttp://rubymotion.jp/RubyMotionWrappershttp://rubymotion-wrappers.com/
  37. 37. ConclusionRubyが書けてiOS未経験の方にはお薦めRubyMotion以外にRuby使わない人には??xcodeprojが無いので共同作業はしやすい
  38. 38. Thanks!2013/05/819:00∼Hamamatsu.rb#27参加者募集中!http://atnd.org/events/38863
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×