ProMotion 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. data/.gitignore +14 -22
  2. data/.repl_history +0 -0
  3. data/Gemfile.lock +14 -0
  4. data/ProMotion.gemspec +4 -3
  5. data/README.md +252 -25
  6. data/Rakefile +5 -3
  7. data/app/app_delegate.rb +2 -2
  8. data/app/screens/home_screen.rb +14 -3
  9. data/app/screens/test_screen.rb +19 -3
  10. data/lib/ProMotion.rb +0 -8
  11. data/lib/ProMotion/version.rb +1 -1
  12. metadata +32 -31
  13. data/.c9revisions/lib/ProMotion.rb.c9save +0 -1
  14. data/.c9revisions/lib/ProMotion/AppDelegate.rb.c9save +0 -3
  15. data/.c9revisions/lib/ProMotion/classes/Screen.rb.c9save +0 -2
  16. data/lib/ProMotion/AppDelegate.rb +0 -60
  17. data/lib/ProMotion/Console.rb +0 -19
  18. data/lib/ProMotion/ProMotion.rb +0 -3
  19. data/lib/ProMotion/_ext/NavigationController.rb +0 -7
  20. data/lib/ProMotion/_ext/TableViewCell.rb +0 -16
  21. data/lib/ProMotion/_ext/TableViewController.rb +0 -54
  22. data/lib/ProMotion/_ext/ViewController.rb +0 -68
  23. data/lib/ProMotion/_modules/ScreenElements.rb +0 -31
  24. data/lib/ProMotion/_modules/ScreenNavigation.rb +0 -149
  25. data/lib/ProMotion/classes/Element.rb +0 -14
  26. data/lib/ProMotion/classes/Screen.rb +0 -206
  27. data/lib/ProMotion/classes/TableScreen.rb +0 -52
  28. data/lib/ProMotion/helpers/MeasureHelper.rb +0 -18
  29. data/lib/ProMotion/helpers/TabBar.rb +0 -99
  30. data/lib/ProMotion/helpers/ViewHelper.rb +0 -23
  31. data/lib/ProMotion/helpers/motion-table/1st/searchable_table.rb +0 -58
  32. data/lib/ProMotion/helpers/motion-table/1st/sectioned_table.rb +0 -219
  33. data/lib/ProMotion/helpers/motion-table/2nd/grouped_table.rb +0 -12
  34. data/lib/ProMotion/helpers/motion-table/2nd/plain_table.rb +0 -13
  35. data/lib/ProMotion/helpers/motion-table/console.rb +0 -26
  36. data/lib/ProMotion/helpers/system_helper.rb +0 -29
data/.gitignore CHANGED
@@ -1,23 +1,15 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- .repl_history
19
- build
20
- build/*
21
- .*.0??
22
- .rvmrc
1
+ /target
2
+ /lib
3
+ /classes
4
+ /checkouts
5
+ pom.xml
6
+ *.jar
7
+ *.class
8
+ .lein-deps-sum
9
+ .lein-failures
10
+ .lein-plugins
11
+ /build
23
12
  .DS_Store
13
+ *.clj
14
+ .repl_histroy
15
+ .rvmrc
data/.repl_history ADDED
File without changes
data/Gemfile.lock ADDED
@@ -0,0 +1,14 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ProMotion (0.4.0)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+
10
+ PLATFORMS
11
+ ruby
12
+
13
+ DEPENDENCIES
14
+ ProMotion!
data/ProMotion.gemspec CHANGED
@@ -3,12 +3,13 @@ require File.expand_path('../lib/ProMotion/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
  gem.authors = ["Jamon Holmgren", "Silas Matson", "ClearSight Studio"]
6
- gem.email = ["jamon@clearsightstudio.com"]
7
- gem.description = "ProMotion is a new way to organize RubyMotion apps."
6
+ gem.email = ["jamon@clearsightstudio.com", "silas@clearsightstudio.com", "contact@clearsightstudio.com"]
7
+ gem.description = "ProMotion is a new way to easily build RubyMotion iOS apps."
8
8
  gem.summary = "
9
9
  ProMotion is a new way to organize RubyMotion apps. Instead of dealing
10
10
  with UIViewControllers, you work with Screens. Screens are
11
- a logical way to think of your app -- similar in some ways to Storyboards.
11
+ a logical way to think of your app and include a ton of great
12
+ utilities to make iOS development more like Ruby and less like Objective-C.
12
13
  "
13
14
  gem.homepage = "https://github.com/clearsightstudio/ProMotion"
14
15
 
data/README.md CHANGED
@@ -3,6 +3,8 @@
3
3
  ProMotion introduces a new object called "Screens". Screens have a one-to-one relationship
4
4
  with your app's designed screens.
5
5
 
6
+ NEW video tutorial! Go watch it here: http://www.clearsightstudio.com/insights/tutorial-make-youtube-video-app-rubymotion-promotion/
7
+
6
8
  Check out the tutorial here: http://www.clearsightstudio.com/insights/ruby-motion-promotion-tutorial
7
9
 
8
10
  Sample app here: https://github.com/jamonholmgren/promotion-tutorial
@@ -26,10 +28,10 @@ Typical app file structure:
26
28
  Loading your home screen:
27
29
 
28
30
  ```ruby
29
- # In /app/app_delegate.rb (note that AppDelegate extends ProMotion::AppDelegateParent)
30
- class AppDelegate < ProMotion::AppDelegateParent
31
+ # In /app/app_delegate.rb
32
+ class AppDelegate < ProMotion::AppDelegate
31
33
  def on_load(app, options)
32
- open_screen MyHomeScreen.new(nav_bar: true)
34
+ open MyHomeScreen.new(nav_bar: true)
33
35
  end
34
36
  end
35
37
  ```
@@ -54,19 +56,17 @@ class HomeScreen < ProMotion::Screen
54
56
  end
55
57
  ```
56
58
 
57
- Creating a tabbed bar from a screen (this has to be done inside a screen -- it won't work
58
- in your app_delegate.rb). This will set the tab bar as the root view controller for your app,
59
- so keep that in mind.
59
+ Creating a tabbed bar with multiple screens. This will set the tab bar as the root view controller for your app,
60
+ so keep that in mind. It can be done from the AppDelegate#on_load or from a screen.
60
61
 
61
- NOTE: It needs to be done in the on_appear or afterward, not the `on_load` or
62
- `will_appear`. We will likely fix this in the future, but for now that's a restriction.
62
+ ### Creating a tab bar with several screens
63
63
 
64
64
  ```ruby
65
- def on_appear
66
- @home ||= MyHomeScreen.new(nav_bar: true)
67
- @settings ||= SettingsScreen.new
68
- @contact ||= ContactScreen.new(nav_bar: true)
69
- @tab_bar ||= open_tab_bar @home, @settings, @contact
65
+ def on_load(app, options)
66
+ @home = MyHomeScreen.new(nav_bar: true)
67
+ @settings = SettingsScreen.new
68
+ @contact = ContactScreen.new(nav_bar: true)
69
+ @tab_bar = open_tab_bar @home, @settings, @contact
70
70
  end
71
71
  ```
72
72
 
@@ -74,27 +74,32 @@ For each screen that belongs to the tab bar, you need to set the tab name and ic
74
74
  In this example, we would need add the following to the three files (my_home_screen.rb, settings_screen.rb, contact_screen.rb):
75
75
 
76
76
  ```ruby
77
- def on_opened
78
- set_tab_bar_item title: "Tab Name Goes Here", icon: "tab_icon.png" # in resources folder
77
+ def on_load
78
+ set_tab_bar_item title: "Tab Name Goes Here", icon: "icons/tab_icon.png" # in resources/icons folder
79
+
80
+ # or...
81
+ set_tab_bar_item title: "Contacts", system_icon: UITabBarSystemItemContacts
79
82
  end
80
83
  ```
81
84
 
82
- Any view item (UIView, UIButton, etc) can be used with add_element.
85
+ ### Adding view elements
86
+
87
+ Any view item (UIView, UIButton, custom UIView subclasses, etc) can be used with add_element.
83
88
  The second argument is a hash of settings that get applied to the
84
89
  element before it is dropped into the view.
85
90
 
86
91
  ```ruby
87
92
  @label = add_element UILabel.alloc.initWithFrame(CGRectMake(5, 5, 20, 20)), {
88
93
  text: "This is awesome!",
89
- font: UIFont.UIFont.systemFontOfSize(18)
94
+ font: UIFont.systemFontOfSize(18)
90
95
  }
91
96
  ```
92
97
 
93
- Add a nav_bar button and a tab_bar icon:
98
+ Add nav_bar buttons:
94
99
 
95
100
  ```ruby
96
101
  set_nav_bar_right_button "Save", action: :save_something, type: UIBarButtonItemStyleDone
97
- set_tab_bar_item title: "Contacts", system_icon: UITabBarSystemItemContacts
102
+ set_nav_bar_left_button "Cancel", action: :return_to_some_other_screen, type: UIBarButtonItemStylePlain
98
103
  ```
99
104
 
100
105
  Open a new screen:
@@ -102,18 +107,18 @@ Open a new screen:
102
107
  ```ruby
103
108
  def settings_button_tapped
104
109
  # ...with a class...
105
- open_screen SettingsScreen
110
+ open SettingsScreen
106
111
 
107
112
  # ...or with an instance...
108
113
  @settings_screen = SettingsScreen.new
109
- open_screen @settings_screen
114
+ open @settings_screen
110
115
  end
111
116
  ```
112
117
 
113
118
  Open a new screen as a modal:
114
119
 
115
120
  ```ruby
116
- open_screen SettingsScreen, modal: true
121
+ open SettingsScreen, modal: true
117
122
  ```
118
123
 
119
124
  You can pass in arguments to other screens if they have accessors:
@@ -123,7 +128,7 @@ class HomeScreen < ProMotion::Screen
123
128
  # ...
124
129
 
125
130
  def settings_button_tapped
126
- open_screen ProfileScreen.new(user: some_user)
131
+ open ProfileScreen.new(user: some_user)
127
132
  end
128
133
  end
129
134
 
@@ -140,11 +145,11 @@ end
140
145
  Close a screen (modal or in a nav controller), passing back arguments to the previous screen's "on_return" method:
141
146
 
142
147
  ```ruby
143
- class ItemScreen
148
+ class ItemScreen < ProMotion::Screen
144
149
  # ...
145
150
  def save_and_close
146
151
  if @model.save
147
- close_screen(model_saved: true)
152
+ close(model_saved: true)
148
153
  end
149
154
  end
150
155
  end
@@ -266,6 +271,228 @@ your Rakefile and doing this:
266
271
  Creates the tab that is shown in a tab bar item.<br />
267
272
  Arguments: <code>{ icon: "imagename", systemIcon: UISystemIconContacts, title: "tabtitle" }</code>
268
273
  </td>
274
+ </tr>
275
+ <tr>
276
+ <td>&nbsp;</td>
277
+ <td>on_appear</td>
278
+ <td>
279
+ Callback for when the screen appears.<br />
280
+ </td>
281
+ </tr>
282
+ <tr>
283
+ <td>&nbsp;</td>
284
+ <td>will_appear</td>
285
+ <td>
286
+ Callback for before the screen appears.<br />
287
+ </td>
288
+ </tr>
289
+ <tr>
290
+ <td>&nbsp;</td>
291
+ <td>will_disappear</td>
292
+ <td>
293
+ Callback for before the screen disappears.<br />
294
+ </td>
295
+ </tr>
296
+ <tr>
297
+ <td>&nbsp;</td>
298
+ <td>will_rotate(orientation, duration)</td>
299
+ <td>
300
+ Callback for before the screen rotates.<br />
301
+ </td>
302
+ </tr>
303
+ <tr>
304
+ <td>&nbsp;</td>
305
+ <td>on_opened **Deprecated**</td>
306
+ <td>
307
+ Callback when screen is opened via a tab bar. Please don't use this, as it will be removed in the future<br />
308
+ Use will_appear
309
+ </td>
310
+ </tr>
311
+ <tr>
312
+ <td>&nbsp;</td>
313
+ <td>set_nav_bar_left_button(title, args = {})</td>
314
+ <td>
315
+ Set a left nav bar button.<br />
316
+ </td>
317
+ </tr>
318
+ <tr>
319
+ <td>&nbsp;</td>
320
+ <td>set_nav_bar_right_button(title, args = {})</td>
321
+ <td>
322
+ Set a right nav bar button.<br />
323
+ <img src="http://i.imgur.com/whbkc.png" />
324
+ </td>
325
+ </tr>
326
+ <tr>
327
+ <td>&nbsp;</td>
328
+ <td>should_autorotate</td>
329
+ <td>
330
+ iOS 5 return true/false if screen should rotate<br />
331
+ </td>
332
+ </tr>
333
+ <tr>
334
+ <td>&nbsp;</td>
335
+ <td>should_rotate(orientation)</td>
336
+ <td>
337
+ Return true/false for rotation to orientation.<br />
338
+ </td>
339
+ </tr>
340
+ <tr>
341
+ <td>&nbsp;</td>
342
+ <td>supported_orientation?(orientation)</td>
343
+ <td>
344
+ Returns true/false if orientation is in NSBundle.mainBundle.infoDictionary["UISupportedInterfaceOrientations"].<br />
345
+ Shouldn't need to override this.
346
+ </td>
347
+ </tr>
348
+ <tr>
349
+ <td>&nbsp;</td>
350
+ <td>supported_orientations</td>
351
+ <td>
352
+ Returns supported orientation mask<br />
353
+ </td>
354
+ </tr>
355
+ <tr>
356
+ <td>&nbsp;</td>
357
+ <td>title</td>
358
+ <td>
359
+ Returns title of current screen.<br />
360
+ </td>
361
+ </tr>
362
+ <tr>
363
+ <td>&nbsp;</td>
364
+ <td>title=(title)</td>
365
+ <td>
366
+ Sets title of current screen.<br />
367
+ </td>
368
+ </tr>
369
+ <tr>
370
+ <td>
371
+ ScreenElements<br />
372
+ Included in Screen by default
373
+ </td>
374
+ <td>add_element(view, attrs = {})</td>
375
+ <td>
376
+ Adds the view to the screen after applying the attributes.<br />
377
+ </td>
378
+ </tr>
379
+ <tr>
380
+ <td>&nbsp;</td>
381
+ <td>remove_element</td>
382
+ <td>
383
+ Removes the view from the superview and sets it to nil<br />
384
+ </td>
385
+ </tr>
386
+ <tr>
387
+ <td>&nbsp;</td>
388
+ <td>bounds</td>
389
+ <td>
390
+ Accessor for self.view.bounds<br />
391
+ </td>
392
+ </tr>
393
+ <tr>
394
+ <td>&nbsp;</td>
395
+ <td>frame</td>
396
+ <td>
397
+ Accessor for self.view.frame<br />
398
+ </td>
399
+ </tr>
400
+ <tr>
401
+ <td>&nbsp;</td>
402
+ <td>view</td>
403
+ <td>
404
+ Accessor for self.view<br />
405
+ </td>
406
+ </tr>
407
+ <tr>
408
+ <td>
409
+ SystemHelper<br />
410
+ Included in Screen by default
411
+ </td>
412
+ <td>ios_version</td>
413
+ <td>
414
+ Returns the iOS version that is running on the device<br />
415
+ </td>
416
+ </tr>
417
+ <tr>
418
+ <td>&nbsp;</td>
419
+ <td>ios_version_greater?(version)</td>
420
+ <td>
421
+ Returns true if 'ios_version' is greater than the version passed in, false otherwise<br />
422
+ </td>
423
+ </tr>
424
+ <tr>
425
+ <td>&nbsp;</td>
426
+ <td>ios_version_greater_eq?(version)</td>
427
+ <td>
428
+ Returns true if 'ios_version' is greater than or equal to the version passed in, false otherwise<br />
429
+ </td>
430
+ </tr>
431
+ <tr>
432
+ <td>&nbsp;</td>
433
+ <td>ios_version_is?(version)</td>
434
+ <td>
435
+ Returns true if 'ios_version' is equal to the version passed in, false otherwise<br />
436
+ </td>
437
+ </tr>
438
+ <tr>
439
+ <td>&nbsp;</td>
440
+ <td>ios_version_less?(version)</td>
441
+ <td>
442
+ Returns true if 'ios_version' is less than the version passed in, false otherwise<br />
443
+ </td>
444
+ </tr>
445
+ <tr>
446
+ <td>&nbsp;</td>
447
+ <td>ios_version_less_eq?(version)</td>
448
+ <td>
449
+ Returns true if 'ios_version' is less than or equal to the version passed in, false otherwise<br />
450
+ </td>
451
+ </tr>
452
+ <tr>
453
+ <td>ScreenNavigation<br />
454
+ included in Screen
455
+ </td>
456
+ <td>app_delegate</td>
457
+ <td>
458
+ Returns the AppDelegate<br />
459
+ </td>
460
+ </tr>
461
+ <tr>
462
+ <td>&nbsp;</td>
463
+ <td>close(args = {})</td>
464
+ <td>
465
+ Closes the current screen, passes args back to the previous screen's on_return method<br />
466
+ </td>
467
+ </tr>
468
+ <tr>
469
+ <td>&nbsp;</td>
470
+ <td>open_root_screen(screen)</td>
471
+ <td>
472
+ Closes all other open screens and opens `screen` at the root.<br />
473
+ </td>
474
+ </tr>
475
+ <tr>
476
+ <td>&nbsp;</td>
477
+ <td>open(screen, args = {})</td>
478
+ <td>
479
+ Pushes the screen onto the navigation stack or opens in a modal<br />
480
+ argument options :hide_tab_bar, :modal, any accessors in `screen`
481
+ </td>
482
+ </tr>
483
+ <tr>
484
+ <td>&nbsp;</td>
485
+ <td>open_tab(tab)</td>
486
+ <td>
487
+ Opens the tab where the "string" title is equal to the passed in tab<br />
488
+ </td>
489
+ </tr>
490
+ <tr>
491
+ <td>&nbsp;</td>
492
+ <td>open_tab_bar(*screens)</td>
493
+ <td>
494
+ Open a UITabBarController with the specified screens as the root view controller of the current app<br />
495
+ </td>
269
496
  </tr>
270
497
  </table>
271
498
 
data/Rakefile CHANGED
@@ -3,18 +3,20 @@ require 'motion/project'
3
3
  require 'bundler/gem_tasks'
4
4
  Bundler.setup
5
5
  Bundler.require
6
- require 'motion-table'
6
+ # require 'motion-table'
7
7
 
8
8
  Motion::Project::App.setup do |app|
9
9
  # Use `rake config' to see complete project settings.
10
10
  app.name = 'ProMotionTest'
11
- app.version = "0.2.0"
11
+ app.version = "0.3.0"
12
12
 
13
13
 
14
14
  # Devices
15
- app.deployment_target = "4.3"
15
+ app.deployment_target = "5.0"
16
16
  app.device_family = [:iphone, :ipad]
17
17
 
18
+ app.detect_dependencies = false
19
+
18
20
  # Preload screens
19
21
  # app.files = Dir.glob(File.join(app.project_dir, 'lib/**/*.rb')) | app.files
20
22
  end