ProMotion 0.7.8 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. data/.gitignore +2 -1
  2. data/.travis.yml +1 -1
  3. data/ProMotion.gemspec +2 -0
  4. data/README.md +51 -449
  5. data/Rakefile +11 -1
  6. data/app/screens/basic_screen.rb +0 -24
  7. data/lib/ProMotion/cocoatouch/{NavigationController.rb → navigation_controller.rb} +0 -0
  8. data/lib/ProMotion/cocoatouch/split_view_controller.rb +29 -0
  9. data/lib/ProMotion/cocoatouch/tab_bar_controller.rb +43 -0
  10. data/lib/ProMotion/cocoatouch/{TableViewCell.rb → table_view_cell.rb} +0 -1
  11. data/lib/ProMotion/cocoatouch/{TableViewController.rb → table_view_controller.rb} +0 -0
  12. data/lib/ProMotion/cocoatouch/{ViewController.rb → view_controller.rb} +6 -1
  13. data/lib/ProMotion/{screen_helpers → containers}/split_screen.rb +0 -2
  14. data/lib/ProMotion/containers/tabs.rb +95 -0
  15. data/lib/ProMotion/delegate/delegate.rb +2 -13
  16. data/lib/ProMotion/delegate/{delegate_helper.rb → delegate_module.rb} +29 -16
  17. data/lib/ProMotion/delegate/delegate_notifications.rb +17 -8
  18. data/lib/ProMotion/delegate/delegate_parent.rb +11 -0
  19. data/lib/ProMotion/extensions/conversions.rb +20 -0
  20. data/lib/ProMotion/{helpers/logger.rb → logger.rb} +0 -0
  21. data/lib/ProMotion/map/map_screen.rb +6 -0
  22. data/lib/ProMotion/map/map_screen_annotation.rb +56 -0
  23. data/lib/ProMotion/map/map_screen_module.rb +207 -0
  24. data/lib/ProMotion/{push_notifications → push_notification}/push_notification.rb +13 -6
  25. data/lib/ProMotion/{screens → screen}/screen.rb +1 -1
  26. data/lib/ProMotion/{screens/_screen_module.rb → screen/screen_module.rb} +76 -51
  27. data/lib/ProMotion/{screen_helpers → screen}/screen_navigation.rb +8 -12
  28. data/lib/ProMotion/{screens/_tables → table/cell}/table_view_cell_module.rb +18 -27
  29. data/lib/ProMotion/table/data/table_data.rb +98 -0
  30. data/lib/ProMotion/table/extensions/indexable.rb +9 -0
  31. data/lib/ProMotion/table/extensions/refreshable.rb +45 -0
  32. data/lib/ProMotion/table/extensions/searchable.rb +61 -0
  33. data/lib/ProMotion/table/grouped_table.rb +9 -0
  34. data/lib/ProMotion/table/grouped_table_screen.rb +6 -0
  35. data/lib/ProMotion/table/table.rb +312 -0
  36. data/lib/ProMotion/table/table_screen.rb +6 -0
  37. data/lib/ProMotion/{screens/_compatibility → thirdparty}/formotion_screen.rb +18 -5
  38. data/lib/ProMotion/version.rb +1 -1
  39. data/lib/ProMotion/view/styling.rb +137 -0
  40. data/lib/ProMotion/web/web_screen.rb +6 -0
  41. data/lib/ProMotion/web/web_screen_module.rb +155 -0
  42. data/resources/WebScreen.html +6 -0
  43. data/resources/test.jpeg +0 -0
  44. data/spec/functional/func_map_screen_spec.rb +105 -0
  45. data/spec/functional/func_screen_spec.rb +54 -7
  46. data/spec/functional/func_searchable_table_spec.rb +1 -1
  47. data/spec/functional/func_tab_bar_spec.rb +78 -0
  48. data/spec/functional/func_table_screen_spec.rb +61 -14
  49. data/spec/functional/func_web_screen_spec.rb +51 -0
  50. data/spec/helpers/map_screen.rb +51 -0
  51. data/spec/helpers/present_screen.rb +26 -0
  52. data/spec/helpers/tab_screen.rb +4 -0
  53. data/spec/helpers/table_screen.rb +12 -3
  54. data/spec/helpers/table_screen_formotion.rb +25 -0
  55. data/spec/helpers/table_screen_indexable.rb +13 -0
  56. data/spec/helpers/test_delegate.rb +28 -0
  57. data/spec/helpers/web_screen.rb +22 -0
  58. data/spec/unit/delegate_spec.rb +53 -4
  59. data/spec/unit/map_spec.rb +48 -0
  60. data/spec/unit/screen_helpers_spec.rb +24 -16
  61. data/spec/unit/screen_spec.rb +22 -18
  62. data/spec/unit/split_screen_in_tab_bar_spec.rb +2 -2
  63. data/spec/unit/split_screen_open_screen_spec.rb +15 -10
  64. data/spec/unit/split_screen_spec.rb +2 -2
  65. data/spec/unit/tab_spec.rb +41 -0
  66. data/spec/unit/tables/formotion_screen_spec.rb +16 -0
  67. data/spec/unit/tables/table_indexable_spec.rb +12 -0
  68. data/spec/unit/tables/table_module_spec.rb +24 -9
  69. data/spec/unit/tables/table_screen_spec.rb +1 -1
  70. data/spec/unit/tables/table_view_cell_spec.rb +9 -8
  71. data/spec/unit/view_helper_spec.rb +2 -2
  72. data/spec/unit/web_spec.rb +106 -0
  73. metadata +96 -35
  74. data/lib/ProMotion/cocoatouch/SplitViewController.rb +0 -23
  75. data/lib/ProMotion/helpers/console.rb +0 -29
  76. data/lib/ProMotion/helpers/measure_helper.rb +0 -20
  77. data/lib/ProMotion/helpers/system_helper.rb +0 -29
  78. data/lib/ProMotion/helpers/view_helper.rb +0 -82
  79. data/lib/ProMotion/screen_helpers/screen_elements.rb +0 -36
  80. data/lib/ProMotion/screen_helpers/screen_tabs.rb +0 -95
  81. data/lib/ProMotion/screens/_table_screen_module.rb +0 -47
  82. data/lib/ProMotion/screens/_tables/_refreshable_table.rb +0 -45
  83. data/lib/ProMotion/screens/_tables/_searchable_table.rb +0 -60
  84. data/lib/ProMotion/screens/_tables/_sectioned_table.rb +0 -5
  85. data/lib/ProMotion/screens/_tables/_table.rb +0 -169
  86. data/lib/ProMotion/screens/_tables/grouped_table.rb +0 -16
  87. data/lib/ProMotion/screens/_tables/plain_table.rb +0 -17
  88. data/lib/ProMotion/screens/_tables/table_data.rb +0 -175
  89. data/lib/ProMotion/screens/behaves_like_screen.rb +0 -10
  90. data/lib/ProMotion/screens/table_screen.rb +0 -16
  91. data/spec/unit/ios_version_spec.rb +0 -28
data/.gitignore CHANGED
@@ -22,4 +22,5 @@ tmp
22
22
  .ruby-gemset
23
23
  .ruby-version
24
24
  .DS_Store
25
- .dat*
25
+ .dat*
26
+ .rake_tasks*
@@ -3,4 +3,4 @@ gemfile:
3
3
  - Gemfile
4
4
  before_script: bundle install
5
5
  script: bundle exec rake spec
6
- bump: 3
6
+ bump: 5
@@ -20,7 +20,9 @@ Gem::Specification.new do |gem|
20
20
  gem.require_paths = ["lib"]
21
21
  gem.version = ProMotion::VERSION
22
22
 
23
+ gem.add_development_dependency("webstub")
23
24
  gem.add_development_dependency("motion-stump")
24
25
  gem.add_development_dependency("motion-redgreen")
26
+ gem.add_development_dependency("formotion")
25
27
  gem.add_development_dependency("rake")
26
28
  end
data/README.md CHANGED
@@ -2,7 +2,10 @@
2
2
 
3
3
  ## A new way to easily build RubyMotion apps.
4
4
 
5
- ProMotion is a RubyMotion gem that makes iOS development more like Ruby and less like Objective-C. It introduces a clean, Ruby-style syntax for building screens that is easy to learn and remember.
5
+ ProMotion is a RubyMotion gem that makes iOS development more like Ruby and less like Objective-C.
6
+ It introduces a clean, Ruby-style syntax for building screens that is easy to learn and remember and
7
+ abstracts a ton of boilerplate UIViewController, UINavigationController, and other iOS code into a
8
+ simple, Ruby-like DSL.
6
9
 
7
10
  ```ruby
8
11
  class AppDelegate < PM::Delegate
@@ -33,479 +36,78 @@ class NewScreen < PM::TableScreen
33
36
  end
34
37
  ```
35
38
 
39
+ # Features
36
40
 
37
- Featured on the RubyMotion blog: [http://blog.rubymotion.com/post/50523137515/introducing-promotion-a-full-featured-rubymotion](http://blog.rubymotion.com/post/50523137515/introducing-promotion-a-full-featured-rubymotion)
38
-
39
- ## New: Version 1.0 is on its way!
40
-
41
- Go check out the [version-1.0](https://github.com/clearsightstudio/ProMotion/tree/version-1.0) branch --
42
- it's got some great improvements and cleaner source code. Although it's not completely ready to launch,
43
- we recommend trying it out.
44
-
45
-
46
- **Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*
47
-
48
- - [ProMotion ](#promotion-)
49
- - [A new way to easily build RubyMotion apps.](#a-new-way-to-easily-build-rubymotion-apps)
50
- - [Tutorials](#tutorials)
51
- - [Screencasts](#screencasts)
52
- - [Sample Apps](#sample-apps)
53
- - [Apps Built With ProMotion](#apps-built-with-promotion)
54
- - [Getting Started](#getting-started)
55
- - [Setup](#setup)
56
- - [What's New?](#whats-new)
57
- - [Version 0.7](#version-07)
58
- - [Usage](#usage)
59
- - [Creating a basic screen](#creating-a-basic-screen)
60
- - [Loading your first screen](#loading-your-first-screen)
61
- - [Creating a split screen (iPad apps only)](#creating-a-split-screen-ipad-apps-only)
62
- - [Creating a tab bar](#creating-a-tab-bar)
63
- - [Add navigation bar buttons](#add-navigation-bar-buttons)
64
- - [Opening and closing screens](#opening-and-closing-screens)
65
- - [Note about split screens and universal apps](#note-about-split-screens-and-universal-apps)
66
- - [Adding view elements](#adding-view-elements)
67
- - [Table Screens](#table-screens)
68
- - [Using your own UIViewController](#using-your-own-uiviewcontroller)
69
- - [API Reference](#api-reference)
70
- - [Help](#help)
71
- - [Contributing](#contributing)
72
- - [Working on Features](#working-on-features)
73
- - [Submitting a Pull Request](#submitting-a-pull-request)
74
- - [Primary Contributors](#primary-contributors)
41
+ |Screens|Navigation Bars|Tab Bars|
42
+ |---|---|---|
43
+ |![ProMotion Screen](https://f.cloud.github.com/assets/1479215/751058/486b6e1e-e4e7-11e2-9d1f-d9380a58f643.png)|![ProMotion Nav Bar](https://f.cloud.github.com/assets/1479215/751076/e4762858-e4e7-11e2-8442-ac7c9ad142e6.png)|![ProMotion Tabs](https://f.cloud.github.com/assets/1479215/751128/76ebe320-e4e9-11e2-86ee-d81c4c1e92f2.png)|
75
44
 
76
- # Tutorials
77
-
78
- http://www.clearsightstudio.com/insights/ruby-motion-promotion-tutorial
45
+ |Table Screens|Grouped Tables|Searchable|Refreshable|
46
+ |---|---|---|---|
47
+ |![ProMotion TableScreen](https://f.cloud.github.com/assets/1479215/751067/8fe7631a-e4e7-11e2-84f1-6ae50ac4f8e8.png)|![ProMotion Grouped Table Screens](https://f.cloud.github.com/assets/1479215/751162/a805b9da-e4ea-11e2-9c39-0c65f8a8de77.png)|![Searchable](https://f.cloud.github.com/assets/1479215/707490/ba750216-de1d-11e2-9594-0880b12f8ffe.png)|![Refreshable](https://f.cloud.github.com/assets/139261/472574/af268e52-b735-11e2-8b9b-a9245b421715.gif)|
79
48
 
80
- ## Screencasts
81
49
 
82
- http://www.clearsightstudio.com/insights/tutorial-make-youtube-video-app-rubymotion-promotion/
50
+ |iPad SplitScreens|Map Screens|Web Screens|
51
+ |---|---|---|
52
+ |![ProMotion SplitScreens](https://f.cloud.github.com/assets/1479215/751188/13c3a7c6-e4ec-11e2-8c87-a94e0c07702b.png)|![MapScreen](https://f.cloud.github.com/assets/1479215/751217/dab20958-e4ed-11e2-9b3e-b42c0199d9e7.png)|![ProMotion WebScreen](https://f.cloud.github.com/assets/1479215/751235/b6fe91ba-e4ee-11e2-8707-c74c7f833de3.png)|
83
53
 
84
- ## Sample Apps
85
-
86
- Here's a demo app that is used to test new functionality. You might have to change the Gemfile
87
- source to pull from Github.
88
-
89
- [https://github.com/jamonholmgren/promotion-demo](https://github.com/jamonholmgren/promotion-demo)
90
-
91
- ## Apps Built With ProMotion
92
-
93
- [View apps built with ProMotion (feel free to submit yours in a pull request!)](https://github.com/clearsightstudio/ProMotion/blob/master/PROMOTION_APPS.md)
54
+ #### ...and much more.
94
55
 
95
56
  # Getting Started
96
57
 
97
- ProMotion is designed to be as intuitive and Ruby-like as possible. For example, here is a
98
- typical app folder structure:
99
-
100
- app/
101
- screens/
102
- events/
103
- list_events_screen.rb
104
- show_event_screen.rb
105
- edit_event_screen.rb
106
- home_screen.rb
107
- settings_screen.rb
108
- models/
109
- event.rb
110
- views/
111
- buttons/
112
- save_event_button.rb
113
- app_delegate.rb
114
-
115
- ## Setup
116
-
117
- Create a new RubyMotion project.
118
-
119
- `motion create myapp`
120
-
121
- Open it in your favorite editor, then go into your Rakefile and modify the top to look like the following:
122
-
123
- ```ruby
124
- # -*- coding: utf-8 -*-
125
- $:.unshift("/Library/RubyMotion/lib")
126
- require 'motion/project/template/ios'
127
- require 'bundler'
128
- Bundler.require
129
- ```
130
-
131
-
132
- Create a Gemfile and add the following lines:
133
-
134
- ```ruby
135
- source 'https://rubygems.org'
136
- gem "ProMotion", "~> 0.7.7"
137
- ```
138
-
139
- Run `bundle install` in Terminal to install ProMotion.
140
-
141
- Go into your app/app_delegate.rb file and replace everything with the following:
142
-
143
- ```ruby
144
- class AppDelegate < PM::Delegate
145
- def on_load(app, options)
146
- open HomeScreen.new(nav_bar: true)
147
- end
148
- end
149
- ```
150
-
151
- Note: You can use other keys in `on_load` when you open a new screen:
152
-
153
- * `modal: ` [`true` | `false`]
154
- * `toolbar:` [`true` | `false`]
155
-
156
- Make sure you remove the `didFinishLoadingWithOptions` method or call `super` in it. Otherwise
157
- ProMotion won't get set up and `on_load` won't be called.
158
-
159
- Create a folder in `/app` named `screens`. Create a file in that folder named `home_screen.rb`.
160
-
161
- Now drop in this code:
162
-
163
- ```ruby
164
- class HomeScreen < PM::Screen
165
- title "Home"
166
-
167
- def will_appear
168
- set_attributes self.view, {
169
- backgroundColor: UIColor.whiteColor
170
- }
171
- end
172
- end
173
- ```
174
-
175
-
176
- Run `rake`. You should now see the simulator open with your home screen and a navigation bar like the image below. Congrats!
177
-
178
- ![ProMotion Home Screen](http://clearsightstudio.github.com/ProMotion/img/ProMotion/home-screen.png)
179
-
58
+ Check out our new [Getting Started Guide](https://github.com/clearsightstudio/ProMotion/wiki/Getting-Started-Guide) in the wiki!
180
59
 
181
60
  # What's New?
182
61
 
183
- ## Version 0.7
184
-
185
- * Added [Teacup](https://github.com/rubymotion/teacup) support! Just specify `stylename:` in your `add:` or `set_attributes:` property hash.
186
- * Added `PM::FormotionScreen` for easy [Formotion](https://github.com/clayallsopp/formotion) compatibility.
187
- * Massive refactor of `PM::TableScreen` to make it more reliable and testable. Deprecated some old stuff in there.
188
- * Made a new `TableViewCellModule` that makes it easy to set up custom cells.
189
- * Refactored the `PM::Delegate` class to make it cleaner and more testable.
190
- * Added `PM::PushNotification` class (this needs more work and testing) and some nice `PM::Delegate` methods for registering and handling them.
191
- * `set_nav_bar_left_button` and `set_nav_bar_right_button` are now just `set_nav_bar_button`. See API reference.
192
- * Speaking of API reference, [we now have one](https://github.com/clearsightstudio/ProMotion/wiki/_pages). We've moved the bulk of the info to the wiki.
193
- * Added `open_modal` alias for `open @screen, modal: true`
194
- * Added functional (interactive) tests and lots of unit tests. Run `rake spec:functional` or `rake spec:unit` to run them individually.
195
- * Renamed `is_modal?` to `modal?`, `has_nav_bar?` to `nav_bar?` in screens.
196
- * Removed MotionTable references.
197
- * Lots of small improvements and bugfixes.
198
-
199
- # Usage
200
-
201
- ## Creating a basic screen
202
-
203
- ```ruby
204
- class HomeScreen < PM::Screen
205
- title "Home"
206
-
207
- def on_load
208
- # Load data
209
- end
210
-
211
- def will_appear
212
- # Set up the elements in your view with add
213
- @label ||= add UILabel.alloc.initWithFrame(CGRectMake(5, 5, 20, 20))
214
- end
215
-
216
- def on_appear
217
- # Everything's loaded and visible
218
- end
219
- end
220
- ```
221
-
222
- ## Loading your first screen
223
-
224
- ```ruby
225
- # In app/app_delegate.rb
226
- class AppDelegate < PM::Delegate
227
- def on_load(app, options)
228
- open MyHomeScreen.new(nav_bar: true)
229
- end
230
- end
231
- ```
232
-
233
- ## Creating a split screen (iPad apps only)
234
-
235
- ```ruby
236
- # In app/app_delegate.rb
237
- class AppDelegate < PM::Delegate
238
- def on_load(app, options)
239
- open_split_screen MenuScreen, DetailScreen
240
- end
241
- end
242
- ```
243
-
244
- ## Creating a tab bar
245
-
246
- Creating a tabbed bar with multiple screens. This will set the tab bar as the root view controller for your app,
247
- so keep that in mind. It can be done from the AppDelegate#on_load or from a screen (that screen will go away, though).
248
-
249
- ```ruby
250
- def on_load(app, options)
251
- @home = MyHomeScreen.new(nav_bar: true)
252
- @settings = SettingsScreen.new
253
- @contact = ContactScreen.new(nav_bar: true)
254
-
255
- open_tab_bar @home, @settings, @contact
256
- end
257
- ```
258
-
259
- For each screen that belongs to the tab bar, you need to set the tab name and icon in the files.
260
- In this example, we would need add the following to the three files (my_home_screen.rb, settings_screen.rb, contact_screen.rb):
261
-
262
- ```ruby
263
- def on_load
264
- set_tab_bar_item title: "Tab Name Goes Here", icon: "icons/tab_icon.png" # in resources/icons folder
265
-
266
- # or...
267
- set_tab_bar_item system_icon: UITabBarSystemItemContacts
268
- end
269
- ```
270
-
271
- To programmatically switch to a different tab, use `open_tab`.
272
-
273
- ```ruby
274
- def some_action
275
- open_tab "Contacts"
276
- end
277
- ```
278
-
279
- ## Add navigation bar buttons
280
-
281
- This method adds the buttons to the top navigation bar of a screen. The `action:` lets you specify a method to
282
- call when that button is tapped, and you can pass in a UIBarButton style using `type:`.
283
-
284
- ```ruby
285
- set_nav_bar_button :right, title: "Save", action: :save_something, type: UIBarButtonItemStyleDone
286
- set_nav_bar_button :left, title: "Cancel", action: :return_to_some_other_screen, type: UIBarButtonItemStylePlain
287
- ```
288
-
289
- You can pass in an image with `image:`. *Don't forget retina and landscape versions of your image!*
290
-
291
- ```ruby
292
- set_nav_bar_button :left, image: UIImage.imageNamed("cancel-button"), action: :cancel_something
293
- ```
294
-
295
- You can also pass in a `system_icon` instead.
296
-
297
- ```ruby
298
- set_nav_bar_button :right, system_icon: UIBarButtonSystemItemAdd, action: :add_something
299
- ```
300
-
301
- Additionally, if you pass an instance of a `UIBarButtonItem`, the `UIBarButton` will automatically display that particular button item.
302
-
303
- ```ruby
304
- set_nav_bar_button :left, button: UIBarButtonItem.alloc.initWithCustomView(button)
305
- ```
306
-
307
- ## Opening and closing screens
308
-
309
- If the user taps something and you want to open a new screen, it's easy. Just use `open` and pass in the screen class
310
- or an instance of that screen.
311
-
312
- ```ruby
313
- def settings_button_tapped
314
- # ...with a class...
315
- open SettingsScreen
316
-
317
- # ...or with an instance...
318
- @settings_screen = SettingsScreen.new
319
- open @settings_screen
320
- end
321
- ```
322
-
323
- You can also open a screen as a modal.
324
-
325
- ```ruby
326
- open SettingsScreen.new, modal: true
327
-
328
- # Or... (this is equivalent)
329
-
330
- open_modal SettingsScreen.new
331
- ```
332
-
333
- You can pass in arguments to other screens if they have accessors:
334
-
335
- ```ruby
336
- class HomeScreen < PM::Screen
337
- # ...
338
-
339
- def settings_button_tapped
340
- open ProfileScreen.new(user: some_user)
341
- end
342
- end
343
-
344
- class ProfileScreen < PM::Screen
345
- attr_accessor :user
346
-
347
- def on_load
348
- self.user # => some_user instance
349
- end
350
- end
351
- ```
352
-
353
- Closing a screen is as easy as can be.
354
-
355
- ```ruby
356
- # User taps a button, indicating they want to close this screen.
357
- def close_screen_tapped
358
- close
359
- end
360
- ```
361
-
362
- You can close a screen (modal or in a nav controller) and pass back arguments to the previous screen's "on_return" method:
363
-
364
- ```ruby
365
- class ItemScreen < PM::Screen
366
- # ...
367
- def save_and_close
368
- if @model.save
369
- close(model_saved: true)
370
- end
371
- end
372
- end
373
-
374
- class MainScreen < PM::Screen
375
- # ...
376
- def on_return(args = {})
377
- if args[:model_saved]
378
- self.reload_something
379
- end
380
- end
381
- end
382
- ```
383
-
384
- ### Note about split screens and universal apps
385
-
386
- It's common to want to open a screen in the same navigation controller if on iPhone but
387
- in a separate detail view when on iPad. Here's a good way to do that.
388
-
389
- ```ruby
390
- class MenuScreen < PM::TableScreen
391
- # ...
392
- def some_action
393
- open SomeScreen.new, in_detail: true
394
- end
395
- end
396
- ```
397
-
398
- The `in_detail` option tells ProMotion to look for a split screen and open in the detail screen
399
- if it's available. If not, open normally. This also works for `in_master:`.
400
-
401
- ## Adding view elements
402
-
403
- Any view item (UIView, UIButton, custom UIView subclasses, etc) can be added to the current view with `add`.
404
- `add` accepts a second argument which is a hash of attributes that get applied to the element right after it is
405
- dropped into the view.
62
+ ## Version 1.0
63
+
64
+ * **New Screen** [`PM::MapScreen`](https://github.com/clearsightstudio/ProMotion/wiki/API-Reference:-ProMotion::MapScreen)
65
+ * **New Screen** [`PM::WebScreen`](https://github.com/clearsightstudio/ProMotion/wiki/API-Reference:-ProMotion::WebScreen)
66
+ * Added [`indexable`](https://github.com/clearsightstudio/ProMotion/wiki/API-Reference:-ProMotion::TableScreen#indexable) as a `PM::TableScreen` feature
67
+ * Added `PM::SplitViewController` and the ability to open a screen `in_detail:` or `in_master:`. [More info here.](https://github.com/clearsightstudio/ProMotion/wiki/API-Reference:-ProMotion::Screen#openscreen-args--)
68
+ * Added `PM::TabBarController` and `PM::Tabs` and refactored the `open_tab_bar` code
69
+ * **IMPORTANT:** Changed `on_load` to fire more consistently. You are now encouraged to put your view setup code in here rather than `will_appear`.
70
+ * Many methods that used to require long UIKit constants now take short :symbols. Check documentation.
71
+ * Simpler `PM::Delegate` code, added `will_load(app, options)` and others. [See the documentation.](https://github.com/clearsightstudio/ProMotion/wiki/API-Reference:-ProMotion::Delegate)
72
+ * [Added a few keys and improvements](https://github.com/clearsightstudio/ProMotion/wiki/Reference%3A-All-available-table_data-options) to table_data
73
+ * Removed `PM::SectionedTableScreen` (`PM::TableScreen` is already a sectioned table)
74
+ * Removed any last UIKit monkeypatching. Everything is a subclass now. ProMotion is probably the least invasive RubyMotion gem in common use.
75
+ * Push Notification updates
76
+ * Renamed `PM::ViewHelper` to `PM::Styling` and [added some common helpers](https://github.com/clearsightstudio/ProMotion/wiki/API-Reference:-ProMotion::Screen#hex_colorstr)
77
+ * Added `will_present`, `on_present`, `will_dismiss`, `on_dismiss` to screens
78
+ * Major internal refactors everywhere
79
+ * Lots of new unit & functional tests
80
+ * Removed deprecations, cleaned up a lot of code
81
+ * Huge improvements to the [wiki](https://github.com/clearsightstudio/ProMotion/wiki)
406
82
 
407
- `add(view, attr={})`
408
-
409
- ```ruby
410
- add UILabel.new, {
411
- text: "This is awesome!",
412
- font: UIFont.systemFontOfSize(18),
413
- resize: [ :left, :right, :top, :bottom, :width, :height ], # autoresizingMask
414
- left: 5, # These four attributes are used with CGRectMake
415
- top: 5,
416
- width: 20,
417
- height: 20
418
- }
419
- ```
420
-
421
- Using Teacup? Just provide a `stylename`.
422
-
423
- ```ruby
424
- @element = UIView.alloc.initWithFrame(CGRectMake(0, 0, 20, 20))
425
- add @element, stylename: :my_custom_view
426
- ```
427
-
428
- The `set_attributes` method is identical to add except that it does not add it to the current view.
429
- If you use snake_case and there isn't an existing method, it'll try camelCase. This allows you to
430
- use snake_case for Objective-C methods.
431
-
432
- `set_attributes(view, attr={})`
433
-
434
- ```ruby
435
- set_attributes UIView.new, {
436
- # `background_color` is translated to `backgroundColor` automatically.
437
- background_color: UIColor.whiteColor,
438
- frame: CGRectMake(0, 0, 20, 20)
439
- }
440
- ```
441
-
442
- You can use `add_to` to add a view to any other view, not just the main view.
443
-
444
- `add_to(parent_view, new_view, attr={})`
83
+ # Tutorials
445
84
 
446
- ```ruby
447
- add_to @some_parent_view, UIView.new, {
448
- frame: CGRectMake(0, 0, 20, 20),
449
- backgroundColor: UIColor.whiteColor
450
- }
451
- ```
85
+ Shows how to make a basic app in ProMotion. Updated in May.
452
86
 
453
- ## Table Screens
87
+ [http://www.clearsightstudio.com/insights/ruby-motion-promotion-tutorial](http://www.clearsightstudio.com/insights/ruby-motion-promotion-tutorial)
454
88
 
455
- You can create sectioned table screens easily with TableScreen, SectionedTableScreen, and GroupedTableScreen.
89
+ ## Screencasts
456
90
 
457
- ```ruby
458
- class SettingsScreen < PM::GroupedTableScreen
459
- title "Settings"
91
+ Shows how to create a Youtube app that shows Portland Trailblazer highlights.
460
92
 
461
- def on_load
462
- set_nav_bar_right_button("Save", action: :save)
463
- set_tab_bar_item(title: "Settings", icon: "settings.png")
464
- end
93
+ [http://www.clearsightstudio.com/insights/tutorial-make-youtube-video-app-rubymotion-promotion/](http://www.clearsightstudio.com/insights/tutorial-make-youtube-video-app-rubymotion-promotion/)
465
94
 
466
- # table_data is automatically called. Use this format in the return value.
467
- # It's an array of cell groups, each cell group consisting of a title and an array of cells.
468
- def table_data
469
- [{
470
- title: "Your Account",
471
- cells: [
472
- { title: "Edit Profile", action: :edit_profile, arguments: { id: 3 } },
473
- { title: "Log Out", action: :log_out },
474
- { title: "Notification Settings", action: :notification_settings }
475
- ]
476
- }, {
477
- title: "App Stuff",
478
- cells: [
479
- { title: "About", action: :show_about },
480
- { title: "Feedback", action: :show_feedback }
481
- ]
482
- }]
483
- end
95
+ ## Sample Apps
484
96
 
485
- # This method allows you to create a "jumplist", the index on the right side of the table
486
- def table_data_index
487
- # Ruby magic to make an alphabetical array of letters.
488
- # Try this in Objective-C and tell me you want to go back.
489
- return ("A".."Z").to_a
490
- end
97
+ Here's a demo app that is used to test new functionality. You might have to change the Gemfile
98
+ source to pull from Github.
491
99
 
492
- # Your table cells, when tapped, will execute the corresponding actions
493
- # and pass in the specified arguments.
494
- def edit_profile(args={})
495
- puts args[:id] # => 3
496
- end
497
- end
498
- ```
100
+ [https://github.com/jamonholmgren/promotion-demo](https://github.com/jamonholmgren/promotion-demo)
499
101
 
500
- ## Using your own UIViewController
102
+ Here's a demo app showing some styling options.
501
103
 
502
- ### [Usage: Formotion or other custom UIViewControllers](https://github.com/clearsightstudio/ProMotion/wiki/Usage:-Formotion-or-other-custom-UIViewControllers)
104
+ [https://github.com/jamonholmgren/promotion-styling](https://github.com/jamonholmgren/promotion-styling)
503
105
 
504
106
  # API Reference
505
107
 
506
- We've created a fairly comprehensive wiki with code examples, usage examples, and API reference.
108
+ We've created a comprehensive and always updated wiki with code examples, usage examples, and API reference.
507
109
 
508
- ### [ProMotion API Reference](https://github.com/clearsightstudio/ProMotion/wiki/_pages)
110
+ ### [ProMotion API Reference](https://github.com/clearsightstudio/ProMotion/wiki)
509
111
 
510
112
  # Help
511
113
 
@@ -519,7 +121,7 @@ and let's discuss. **It's a good idea to run your idea by the committers before
519
121
  a pull request.** We'll always consider your ideas carefully but not all ideas will be
520
122
  incorporated.
521
123
 
522
- ## Working on Features
124
+ ## Working on New Features
523
125
 
524
126
  1. Clone the repos into `Your-Project/Vendor/ProMotion`
525
127
  2. Update your `Gemfile`to reference the project as `gem 'ProMotion', :path => "vendor/ProMotion/"`