ruby/rubycocoa for iphone - uicoderz4
DESCRIPTION
this slide is written in Japanese iphone-rubycocoa project (in English): http://wiki.github.com/takuma104/iphone-rubycocoaTRANSCRIPT
![Page 1: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/1.jpg)
Ruby / RubyCocoafor iPhone
@takuma104
![Page 2: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/2.jpg)
発端
![Page 3: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/3.jpg)
iPhoneでC#(CIL)が動いてる
![Page 4: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/4.jpg)
monoでAOTで動くらしい
![Page 5: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/5.jpg)
じゃ
![Page 6: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/6.jpg)
Rubyも(もちろん)動くよね??
![Page 7: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/7.jpg)
では
![Page 8: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/8.jpg)
移植
![Page 9: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/9.jpg)
というかなんとか動かしたい
![Page 10: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/10.jpg)
まずRubyの話
![Page 11: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/11.jpg)
話はOS1.0.x時代 (JB)
![Page 12: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/12.jpg)
Rubyを動かすのが流行った
![Page 13: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/13.jpg)
が
![Page 14: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/14.jpg)
irbうごかねーじゃん!!!
![Page 15: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/15.jpg)
メモリ足りないで落ちる??
![Page 16: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/16.jpg)
仕方無いのでeval.rbで楽しむ
![Page 17: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/17.jpg)
…うむむ。
![Page 18: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/18.jpg)
捨て
![Page 19: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/19.jpg)
話は戻ってiPhoneSDK 2.x
![Page 20: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/20.jpg)
ちょっと制限きつくなった
かも?
![Page 21: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/21.jpg)
consoleがない
![Page 22: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/22.jpg)
stdout/stderr はとりあえずXcodeのDebug出力
![Page 23: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/23.jpg)
動的リンクできない
![Page 24: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/24.jpg)
全部static link
![Page 25: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/25.jpg)
アプリ外の領域のファイル読み書き不可
![Page 26: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/26.jpg)
とかとか
![Page 27: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/27.jpg)
configureとの格闘
![Page 28: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/28.jpg)
とりあえずいらないヘッダ削る
![Page 29: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/29.jpg)
削る
![Page 30: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/30.jpg)
なんか要らないヘッダ
![Page 31: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/31.jpg)
なんかマクロ
![Page 32: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/32.jpg)
なんとか動いた (1.8.7)
![Page 33: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/33.jpg)
samples/test.rbの8割動く
![Page 34: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/34.jpg)
8割
![Page 35: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/35.jpg)
Process.kill($$)できない
![Page 36: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/36.jpg)
リソースフォルダにファイル書けない
![Page 37: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/37.jpg)
外部のminiryby起動
できない
![Page 38: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/38.jpg)
とりあえず動いたといっていいかな…
![Page 39: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/39.jpg)
irbモドキをアプリにした
![Page 40: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/40.jpg)
![Page 41: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/41.jpg)
提出
![Page 42: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/42.jpg)
待機
![Page 43: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/43.jpg)
却下
![Page 44: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/44.jpg)
理由
![Page 45: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/45.jpg)
「どんなRubyのコードでも動いちゃう
っぽくね?(怒)」
![Page 46: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/46.jpg)
(電卓とか作って出したらどうなるんだろう…)
![Page 47: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/47.jpg)
あとで。
![Page 48: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/48.jpg)
TODO
![Page 49: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/49.jpg)
test/test_*.rb 動かす
![Page 50: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/50.jpg)
irb動かす(ioをtelnet
で)
![Page 51: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/51.jpg)
longjmp()なんか
おかしい問題
![Page 52: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/52.jpg)
rubyの中だけで完結したraiseのrescueは問題ないっぽいが…
![Page 53: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/53.jpg)
C側でrb_longjmpされたのが補足されないっぽい
![Page 54: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/54.jpg)
組込
![Page 55: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/55.jpg)
全部static linkにできたので
![Page 56: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/56.jpg)
.h 5コぐらいと、.a 1コ
![Page 57: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/57.jpg)
lib/用のtar1コ
(resource)
![Page 58: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/58.jpg)
ruby_init()
rb_eval_string_protect()
![Page 59: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/59.jpg)
Ruby Scriptを文字列で渡してやると実行してそのまま値を返す
![Page 60: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/60.jpg)
くわしくはirbアプリのEvalRubyクラス参照
![Page 61: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/61.jpg)
次
![Page 62: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/62.jpg)
RubyCocoaのお話
![Page 63: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/63.jpg)
RubyでCocoaを使える
![Page 64: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/64.jpg)
?
![Page 65: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/65.jpg)
ObjCな人から見たメリット(?)
![Page 66: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/66.jpg)
例
![Page 67: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/67.jpg)
ObjCメソッド呼び出し
![Page 68: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/68.jpg)
[[UIViewalloc]initWithFrame(CGRectZero)]↓OSX::UIView.alloc.initWithFrame([0,0,0,0])
![Page 69: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/69.jpg)
ほとんど書き方が一緒
![Page 70: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/70.jpg)
かつ
![Page 71: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/71.jpg)
[[ ]]
![Page 72: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/72.jpg)
無い
![Page 73: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/73.jpg)
!!!
![Page 74: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/74.jpg)
型
![Page 75: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/75.jpg)
つねにid型になってるイメージ
![Page 76: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/76.jpg)
プリミティブ型は自動変換
![Page 77: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/77.jpg)
構造体は?
![Page 78: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/78.jpg)
配列からCGRectとか自動変換
![Page 79: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/79.jpg)
delegationとか
どうなるの?
![Page 80: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/80.jpg)
OSX::NSObjcetを継承したクラスは普通に受けられる
![Page 81: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/81.jpg)
@interfaceHoge@end
@implementHoge‐applicationDidFinishLaunching(UIApplication*app){NSLog(“%s”,class_getName(app‐>isa));}@end
intmain(){returnUIApplicationMain(0,nil,nil,@”Hoge”);}
![Page 82: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/82.jpg)
classHoge<OSX::NSObject defapplicationDidFinishLaunching(app) papp endend
OSX.UIApplicationMain(0,nil,nil,"Hoge")
![Page 83: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/83.jpg)
classFuga<OSX::UIView definitialize @tv=OSX::UITableView.alloc.initWithFrame(OSX::UIScreen.mainScreen.bounds) @tv.setValue_forKey(self,"delegate") @tv.setValue_forKey(self,"dataSource") self.addSubview(@tv) end
deftableView_numberOfRowsInSection(tableView,section)return10end
deftableView_cellForRowAtIndexPath(tableView,indexPath)cellIdentifier="Cell"cell=tableView.dequeueReusableCellWithIdentifier(cellIdentifier)if(cell==nil)thencell=OSX::UITableViewCell.alloc.initWithFrame_reuseIdentifier([0,0,0,0],cellIdentifier)endcell.setValue_forKey(indexPath.row.to_s,"text")cellendend#thnaksto@hitoriblog
![Page 84: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/84.jpg)
(そういえば)念願の
![Page 85: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/85.jpg)
GC
![Page 86: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/86.jpg)
参照カウンタ地獄からの
開放
![Page 87: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/87.jpg)
そんなに上手くいかない?
![Page 88: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/88.jpg)
欠点
![Page 89: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/89.jpg)
ネイティブThread使えない
![Page 90: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/90.jpg)
Rubyの使えばいいじゃない
![Page 91: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/91.jpg)
t=Thread.newdop“hoge”end
t.join
![Page 92: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/92.jpg)
Cocoaのセレクタ名が長いので
![Page 93: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/93.jpg)
Rubyでも長さは変らないという話
![Page 94: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/94.jpg)
‐tableView:(UITableView*)vcellForRowAtIndexPath:(NSIndexPath)i;
![Page 95: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/95.jpg)
deftableView_cellForAtRowIndexPath(v,i)
![Page 96: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/96.jpg)
どうしようもなさそう
![Page 97: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/97.jpg)
プロパティのget/setの書き方長い
![Page 98: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/98.jpg)
[UIApplicationsharedInstance].delegate↓OSX::UIApplication.sharedInstance.valueForKey(‘delegate’)
![Page 99: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/99.jpg)
.delegate=self;↓.setValue_forKey(self,‘delegate’)
![Page 100: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/100.jpg)
この書き方はプロパティと同じにできるかも?
![Page 101: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/101.jpg)
ちなみに
![Page 102: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/102.jpg)
HotCocoa.rb
![Page 103: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/103.jpg)
MacRubyの一部分
PureRuby実装のCocoaラッパ
![Page 104: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/104.jpg)
例
![Page 105: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/105.jpg)
require'hotcocoa'includeHotCocoaappdowindow:title=>'HelloWorld',:frame=>[0,0,120,120]do|w|button:title=>'Clickme'do|b|b.on_action{puts'HelloWorld!'}w<<bendendend
![Page 106: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/106.jpg)
詳しくは@lrzさんの資料参照
![Page 107: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/107.jpg)
http://chopine.be/lrz/talks/RubyKaigi2008.pdf
![Page 108: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/108.jpg)
話は戻って
![Page 109: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/109.jpg)
移植
![Page 110: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/110.jpg)
最新(0.13.2)で
調査
![Page 111: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/111.jpg)
まずlibffi動かないっぽい
![Page 112: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/112.jpg)
orz
![Page 113: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/113.jpg)
が
![Page 114: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/114.jpg)
中川さん「古い実装ならlibffi使ってなかったと
思うよ?」
![Page 115: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/115.jpg)
mjd
![Page 116: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/116.jpg)
0.4.2まで使ってなかった
![Page 117: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/117.jpg)
5年前の実装だけど0.4.2ベースで
![Page 118: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/118.jpg)
ということで修正点
![Page 119: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/119.jpg)
ObjC runtimeの構造体に直接をやめてAPI経由
にした
![Page 120: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/120.jpg)
structobjc_methodstructobjc_ivar
![Page 121: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/121.jpg)
とかはもはや使用できないらしい
![Page 122: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/122.jpg)
動的クラス生成
![Page 123: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/123.jpg)
objc_allocateClassPair()objc_registerClassPair()
![Page 124: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/124.jpg)
クラスにメソッドを
追加
![Page 125: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/125.jpg)
class_addMethod()
![Page 126: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/126.jpg)
クラスにメンバ変数を追加
![Page 127: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/127.jpg)
class_addIvar()
![Page 128: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/128.jpg)
構造体などのスタブを生成しているRubyコードを修正
![Page 129: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/129.jpg)
ObjC黒魔術vs
Ruby黒魔術
![Page 130: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/130.jpg)
とりあえず
![Page 131: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/131.jpg)
まだかなり不十分だけどhelloWorldレベルが動く
![Page 132: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/132.jpg)
いちばんやりたかった事、それは…
![Page 133: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/133.jpg)
リモートからirbで実機で動いてるアプリを動作中に変更する
![Page 134: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/134.jpg)
Inspired byJSCocoaの
iPhone用インタラクティブコンソール
![Page 135: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/135.jpg)
TCPサーバをRubyで書いてeval.rbに繋げただけ
![Page 136: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/136.jpg)
(Macとかの) telnetから
コードを弄れる
![Page 137: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/137.jpg)
デモ
![Page 138: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/138.jpg)
githubのrepoで開発継続
![Page 139: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/139.jpg)
Repository:http://github.com/takuma104/iphone‐rubycocoa
RubyCocoa0.4.2to4iPhone:http://github.com/takuma104/iphone‐rubycocoa/commit/0960279bdfe5601e57b3c951f53b8d2e112a997a
![Page 140: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/140.jpg)
今後
![Page 141: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/141.jpg)
楽
![Page 142: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/142.jpg)
して
![Page 143: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/143.jpg)
開発
![Page 144: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/144.jpg)
可能
![Page 145: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/145.jpg)
何か
![Page 146: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/146.jpg)
纏め
![Page 147: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/147.jpg)
Ruby楽しいよRuby
![Page 148: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/148.jpg)
おしまい
![Page 149: Ruby/RubyCocoa for iPhone - UICoderz4](https://reader037.vdocuments.mx/reader037/viewer/2022103110/547e374ab4af9f502d8b45c7/html5/thumbnails/149.jpg)