Slide 1

Slide 1 text

BubbleWrap Marin Usalj @mneorr Tuesday, April 2, 13

Slide 2

Slide 2 text

iOS consultant Ruby <3 Tuesday, April 2, 13

Slide 3

Slide 3 text

ObjectiveRecord ObjectiveSugar Kiwi Bubblewrap Tuesday, April 2, 13

Slide 4

Slide 4 text

[@3 times:^{ NSLog(@"Hello!"); }]; // Hello! // Hello! // Hello! NSDate *future = @(24).days.fromNow; // 2012-12-25 20:49:05 +0000 NSDate *past = @(1).month.ago; // 2012-11-01 20:50:28 +00:00 NSString *sentence = NSStringWithFormat(@"This is a text-with- argument %@", @1234); [sentence split:@"-"] // array = this is a text, with, argument 1234 ObjectiveSugar github.com/mneorr/ObjectiveSugar Tuesday, April 2, 13

Slide 5

Slide 5 text

[cars each:^(id object) { NSLog(@"Car: %@", object); }]; // Car: Testarossa // Car: F50 // Car: F458 Italia [cars map:^id(id car){ return @([[car substringToIndex:1] isEqualToString:@"F"]); }]; // NO (Testarossa) // YES (F50) // YES (F458 Italia) ObjectiveSugar github.com/mneorr/ObjectiveSugar Tuesday, April 2, 13

Slide 6

Slide 6 text

// creating [Person create:@{ @"name" : @"John", @"age" : @12 }]; Person *john = [Person create]; john.name = @"John"; // save/delete [john save]; [john delete]; // querying Person *johnDoe = [Person where:@"name == 'John' AND surname = 'Doe'"].first; NSArray *people = [Person where:@{ @"age" : @18 }]; ObjectiveRecord github.com/mneorr/ObjectiveRecord Tuesday, April 2, 13

Slide 7

Slide 7 text

“ActiveSupport for RubyMotion” Tuesday, April 2, 13

Slide 8

Slide 8 text

Tuesday, April 2, 13

Slide 9

Slide 9 text

Motivation Tuesday, April 2, 13

Slide 10

Slide 10 text

AFJSONRequestOperation.JSONOperationWithReuqest( NSURLRequest.requestWithURL( NSURL.URLWithString(‘http://mneorr.com’)), success: ? failure: ? ).start Tuesday, April 2, 13

Slide 11

Slide 11 text

AFJSONRequestOperation.JSONOperationWithReuqest( NSURLRequest.requestWithURL( NSURL.URLWithString(‘http://mneorr.com’)), success:^{ # handle good response } failure:^{ # handle bad response }).start Tuesday, April 2, 13

Slide 12

Slide 12 text

Tuesday, April 2, 13

Slide 13

Slide 13 text

AFJSONRequestOperation.JSONOperationWithReuqest( NSURLRequest.requestWithURL( NSURL.URLWithString(‘http://mneorr.com’)), success: lambda{|response| # handle good response } failure: lambda{|response, error| # handle bad response }).start Tuesday, April 2, 13

Slide 14

Slide 14 text

Tuesday, April 2, 13

Slide 15

Slide 15 text

AFJSONRequestOperation.JSONOperationWithReuqest( NSURLRequest.requestWithURL( NSURL.URLWithString(‘http://mneorr.com’)), success: lambda{ |request, response, json| # handle good response } failure: lambda{ |request, response, error, json| # handle bad response }).start Tuesday, April 2, 13

Slide 16

Slide 16 text

BW::HTTP Tuesday, April 2, 13

Slide 17

Slide 17 text

HTTP.get(‘http://mneorr.com’) do |response| if response.ok? # handle good response else # handle failure end end Tuesday, April 2, 13

Slide 18

Slide 18 text

params = { foo: ‘bar’, baz: [:bang, :zsh] } HTTP.post(‘http://mneorr.com’, payload: params) do |response| if response.ok? # handle good response else # handle failure end end Tuesday, April 2, 13

Slide 19

Slide 19 text

BW::Core Tuesday, April 2, 13

Slide 20

Slide 20 text

> Device.iphone? # true > Device.ipad? # false > Device.front_camera? # true > Device.orientation # :portrait > Device.simulator? # true > Device.ios_version # "6.0" Tuesday, April 2, 13

Slide 21

Slide 21 text

JSON.parse("{\"foo\":1,\"bar\": [1,2,3],\"baz\":\"awesome\"}") => { foo: 1, bar: [1,2,3], baz: “awesome” } JSON.generate({ foo: 1, bar: [1,2,3], baz: “awesome” }) => "{\"foo\":1,\"bar\":[1,2,3],\"baz\": \"awesome\"}" Tuesday, April 2, 13

Slide 22

Slide 22 text

BW.create_uuid => "68ED21DB-82E5-4A56-ABEB-73650C0DB701" '#FF8A19'.to_color => # App.open_url("http://mneorr.com") # Opens the url using the device's browser. (accepts a string url or an instance of Tuesday, April 2, 13

Slide 23

Slide 23 text

Persistence Tuesday, April 2, 13

Slide 24

Slide 24 text

[Client]: hey, how hard is it to store some user data? We may need to keep track of Foo and Bar! Tuesday, April 2, 13

Slide 25

Slide 25 text

Tuesday, April 2, 13

Slide 26

Slide 26 text

NSUserDefaults.standardUserDefaults .setValue(“Inspect”, forKey:”conference”) conf = NSUserDefaults.standardUserDefaults .valueForKey(“conference”) Tuesday, April 2, 13

Slide 27

Slide 27 text

Y U NO SAVE? Tuesday, April 2, 13

Slide 28

Slide 28 text

You didn’t #synchronize. Tuesday, April 2, 13

Slide 29

Slide 29 text

NSUserDefaults.standardUserDefaults .setValue(“Inspect”, forKey:”conference”) NSUserDefaults.standardUserDefaults .synchronize Tuesday, April 2, 13

Slide 30

Slide 30 text

include App Persistence[‘conference’] = “Inspect” conf = Persistence[‘conference’] Tuesday, April 2, 13

Slide 31

Slide 31 text

BW::Location Tuesday, April 2, 13

Slide 32

Slide 32 text

BW::Location.get do |result| result[:to].longitude result[:from].longitude end BW::Location.get_significant BW::Location.get_once Tuesday, April 2, 13

Slide 33

Slide 33 text

BW::UI Tuesday, April 2, 13

Slide 34

Slide 34 text

Tuesday, April 2, 13

Slide 35

Slide 35 text

view.when_swiped view.when_pressed view.when_panned view.when_pinched view.when_rotated view.when_tapped Tuesday, April 2, 13

Slide 36

Slide 36 text

@recognizer = view.when_swiped Tuesday, April 2, 13

Slide 37

Slide 37 text

BW::Media Tuesday, April 2, 13

Slide 38

Slide 38 text

@playa = BW::Media::Player.new @playa.play_modal(@local_file) Tuesday, April 2, 13

Slide 39

Slide 39 text

BW::Reactor (EventMachine) Tuesday, April 2, 13

Slide 40

Slide 40 text

“There is a ton of great stuff in BubbleWrap.” “If you’re doing any RubyMotion work, I think you should definitely checkout BubbleWrap!” - the changelog Tuesday, April 2, 13

Slide 41

Slide 41 text

“To make our networking code painless, we’ll use BubbleWrap” - smashingmagazine.com “Lots of good stuff in BubbleWrap” - Darrin Holst Tuesday, April 2, 13

Slide 42

Slide 42 text

“If there’s any one thing you can do after starting a RubyMotion project, it’s immediately drop BubbleWrap into your repo.” - Nick, 37 Signals Tuesday, April 2, 13

Slide 43

Slide 43 text

github.com/rubymotion/bubblewrap bubblewrap.io Tuesday, April 2, 13

Slide 44

Slide 44 text

Questions Tuesday, April 2, 13

Slide 45

Slide 45 text

Thanks HipByte! Tuesday, April 2, 13