README.md in ProMotion-0.5.0 vs README.md in ProMotion-0.5.2

- old
+ new

@@ -6,10 +6,11 @@ ## Table of contents 1. [Tutorials](#tutorials) * [Screencasts](#screencasts) * [Sample Apps](#sample-apps) + * [Apps Built With ProMotion](#apps-built-with-promotion) 1. **[Getting Started](#getting-started)** * [Setup](#setup) 1. [What's New?](#whats-new) 1. [Usage](#usage) * [Creating a basic screen](#creating-a-basic-screen) @@ -34,17 +35,24 @@ Video tutorial with 0.4. http://www.clearsightstudio.com/insights/tutorial-make-youtube-video-app-rubymotion-promotion/ -### Sample apps +### Sample Apps -Sample app here: https://github.com/jamonholmgren/promotion-tutorial +#### ProMotion Tutorial +Sample app here: [https://github.com/jamonholmgren/promotion-tutorial](https://github.com/jamonholmgren/promotion-tutorial) -Also, check out the free [BigDay! Reminder app](https://itunes.apple.com/us/app/bigday!/id571756685?ls=1&mt=8) on the +### Apps Built With ProMotion + +#### BigDay! Reminder App +Check out the free [BigDay! Reminder app](https://itunes.apple.com/us/app/bigday!/id571756685?ls=1&mt=8) on the App Store to see what's possible. ClearSight Studio built the app for Kijome Software, a small app investment company. +#### TipCounter App +[TipCounter](http://www.tipcounterapp.com) was built by [Matt Brewer](https://github.com/macfanatic/) for bartenders and servers to easily track their tips. Used ProMotion and the development was a lot of fun! + ## Getting Started ProMotion is designed to be as intuitive and Ruby-like as possible. For example, here is a typical app folder structure: @@ -83,11 +91,11 @@ Create a Gemfile and add the following lines: ```ruby source 'https://rubygems.org' -gem "ProMotion", "~> 0.4.1" +gem "ProMotion", "~> 0.5.0" ``` Run `bundle install` in Terminal to install ProMotion. Go into your app/app_delegate.rb file and add the following: @@ -120,24 +128,26 @@ ![ProMotion Home Screen](http://clearsightstudio.github.com/ProMotion/img/ProMotion/home-screen.png) ## What's New? -### Version 0.5.0 +### Version 0.5 -Version 0.5.0 is mostly a documentation and consistency release. It should be backwards-compatible -with 0.4.0. +Version 0.5 is mostly a documentation and consistency release. It should be backwards-compatible +with 0.4. +* `on_return` fires after animation complete on modals now +* Added tests ... run with `rake spec` (thanks [@macfanatic](http://twitter.com/macfanatic)) * Rearranged internal folders to make a lot more sense * More complete API documentation * Refactored camelCase methods and configs to under_score * Set `should_autorotate` to true by default * Changed `open_screen` to `open` (`open_screen` still works for backwards compatibility) * `add_element` is now `add` (and `remove_element` is `remove`) * Removed built-in app (will release some sample apps soon, including a "Kitchen Sink" one) -### Version 0.4.0 +### Version 0.4 * Screens are now UIViewControllers (they used to contain UIViewControllers, but that got too funky) so you can do normal UIViewController stuff with them * Screen functionality can also be inherited as a module in your own UIViewController, but you need to provide your own methods for viewDidLoad and whatnot. * Tons of headlessCamelCaps methods are now properly_ruby_underscored (with an alias to the old name for compatibility) * `open_screen` and `close_screen` can now just be `open` and `close` respectively @@ -162,12 +172,12 @@ def on_load # Load data end def will_appear - # Set up the elements in your view with add_view - @label = add_view UILabel.alloc.initWithFrame(CGRectMake(5, 5, 20, 20)) + # Set up the elements in your view with add + @label ||= add UILabel.alloc.initWithFrame(CGRectMake(5, 5, 20, 20)) end def on_appear # Everything's loaded and visible end @@ -304,26 +314,26 @@ end ``` ### Adding view elements -Any view item (UIView, UIButton, custom UIView subclasses, etc) can be added to the current view with `add_view`. -`add_view` accepts a second argument which is a hash of attributes that get applied to the element before it is +Any view item (UIView, UIButton, custom UIView subclasses, etc) can be added to the current view with `add`. +`add` accepts a second argument which is a hash of attributes that get applied to the element before it is dropped into the view. ```ruby -@label = add_view UILabel.alloc.initWithFrame(CGRectMake(5, 5, 20, 20)), { +@label = add UILabel.alloc.initWithFrame(CGRectMake(5, 5, 20, 20)), { text: "This is awesome!", font: UIFont.systemFontOfSize(18) } -@element = add_view UIView.alloc.initWithFrame(CGRectMake(0, 0, 20, 20)), { +@element = add UIView.alloc.initWithFrame(CGRectMake(0, 0, 20, 20)), { backgroundColor: UIColor.whiteColor } ``` -The `set_attributes` method is identical to add_view except that it does not add it to the current view. +The `set_attributes` method is identical to add except that it does not add it to the current view. ```ruby @element = set_attributes UIView.alloc.initWithFrame(CGRectMake(0, 0, 20, 20)), { backgroundColor: UIColor.whiteColor } @@ -446,116 +456,102 @@ end ``` ## Reference +### Screen + <table> <tr> - <th>Class or Module</th> <th>Method</th> <th>Description</th> </tr> <tr> - <td>Screen</td> <td>is_modal?</td> <td>Returns if the screen was opened in a modal window.</td> </tr> <tr> - <td>&nbsp;</td> <td>self</td> <td>Returns the Screen which is a subclass of UIViewController or UITableViewController</td> </tr> <tr> - <td>&nbsp;</td> <td>has_nav_bar?</td> <td>Returns if the screen is contained in a navigation controller.</td> </tr> <tr> - <td>&nbsp;</td> <td>set_tab_bar_item(args)</td> <td> Creates the tab that is shown in a tab bar item.<br /> Arguments: <code>{ icon: "imagename", systemIcon: UISystemIconContacts, title: "tabtitle" }</code> </td> </tr> <tr> - <td>&nbsp;</td> <td>on_appear</td> <td> Callback for when the screen appears.<br /> </td> </tr> <tr> - <td>&nbsp;</td> <td>will_appear</td> <td> Callback for before the screen appears.<br /> This is a good place to put your view constructors, but be careful that you don't add things more than on subsequent screen loads. </td> </tr> <tr> - <td>&nbsp;</td> <td>will_disappear</td> <td> Callback for before the screen disappears.<br /> </td> </tr> <tr> - <td>&nbsp;</td> <td>will_rotate(orientation, duration)</td> <td> Callback for before the screen rotates.<br /> </td> </tr> <tr> - <td>&nbsp;</td> <td>on_opened **Deprecated**</td> <td> Callback when screen is opened via a tab bar. Please don't use this, as it will be removed in the future<br /> Use will_appear </td> </tr> <tr> - <td>&nbsp;</td> <td>set_nav_bar_left_button(title, args = {})</td> <td> Set a left nav bar button.<br /> </td> </tr> <tr> - <td>&nbsp;</td> <td>set_nav_bar_right_button(title, args = {})</td> <td> Set a right nav bar button.<br /> <img src="http://i.imgur.com/whbkc.png" /> </td> </tr> <tr> - <td>&nbsp;</td> <td>should_autorotate</td> <td> (iOS 6) return true/false if screen should rotate.<br /> Defaults to true. </td> </tr> <tr> - <td>&nbsp;</td> <td>should_rotate(orientation)</td> <td> (iOS 5) Return true/false for rotation to orientation.<br /> </td> </tr> <tr> - <td>&nbsp;</td> <td>title</td> <td> Returns title of current screen.<br /> </td> </tr> <tr> - <td>&nbsp;</td> <td>title=(title)</td> <td> Sets title of current screen.<br /> You can also set the title like this (not in a method, though):<br /> <pre><code> @@ -568,125 +564,102 @@ end </code></pre> </td> </tr> <tr> - <td> - ScreenElements<br /> - Included in Screen by default - </td> <td>add(view, attrs = {})</td> <td> Adds the view to the screen after applying the attributes.<br /> (alias: `add_element`, `add_view`)<br /> Example: <code> - add_view UIInputView.alloc.initWithFrame(CGRectMake(10, 10, 300, 40)), { + add UIInputView.alloc.initWithFrame(CGRectMake(10, 10, 300, 40)), { backgroundColor: UIColor.grayColor } </code> </td> </tr> <tr> - <td>&nbsp;</td> <td>remove(view)</td> <td> Removes the view from the superview and sets it to nil<br /> (alias: `remove_element`, `remove_view`) </td> </tr> <tr> - <td>&nbsp;</td> <td>bounds</td> <td> Accessor for self.view.bounds<br /> </td> </tr> <tr> - <td>&nbsp;</td> <td>frame</td> <td> Accessor for self.view.frame<br /> </td> </tr> <tr> - <td>&nbsp;</td> <td>view</td> <td> The main view for this screen.<br /> </td> </tr> <tr> - <td> - SystemHelper<br /> - Included in Screen by default - </td> <td>ios_version</td> <td> Returns the iOS version that is running on the device<br /> </td> </tr> <tr> - <td>&nbsp;</td> <td>ios_version_greater?(version)</td> <td> Returns true if 'ios_version' is greater than the version passed in, false otherwise<br /> </td> </tr> <tr> - <td>&nbsp;</td> <td>ios_version_greater_eq?(version)</td> <td> Returns true if 'ios_version' is greater than or equal to the version passed in, false otherwise<br /> </td> </tr> <tr> - <td>&nbsp;</td> <td>ios_version_is?(version)</td> <td> Returns true if 'ios_version' is equal to the version passed in, false otherwise<br /> </td> </tr> <tr> - <td>&nbsp;</td> <td>ios_version_less?(version)</td> <td> Returns true if 'ios_version' is less than the version passed in, false otherwise<br /> </td> </tr> <tr> - <td>&nbsp;</td> <td>ios_version_less_eq?(version)</td> <td> Returns true if 'ios_version' is less than or equal to the version passed in, false otherwise<br /> </td> </tr> <tr> - <td>ScreenNavigation<br /> - included in Screen - </td> <td>app_delegate</td> <td> Returns the AppDelegate<br /> </td> </tr> <tr> - <td>&nbsp;</td> <td>close(args = {})</td> <td> Closes the current screen, passes args back to the previous screen's <code>on_return</code> method<br /> </td> </tr> <tr> - <td>&nbsp;</td> <td>open_root_screen(screen)</td> <td> Closes all other open screens and opens <code>screen</code> as the root view controller.<br /> </td> </tr> <tr> - <td>&nbsp;</td> <td>open(screen, args = {})</td> <td> Pushes the screen onto the navigation stack or opens in a modal<br /> Argument options:<br /> <code>nav_bar: true|false</code> (note: this has no effect if you're already in a navigation controller)<br /> @@ -697,41 +670,41 @@ <code>in_tab: "Tab name"</code> (if you're in a tab bar)<br /> any accessors in <code>screen</code> </td> </tr> <tr> - <td>&nbsp;</td> <td>open_tab_bar(*screens)</td> <td> Open a UITabBarController with the specified screens as the root view controller of the current app<br /> </td> </tr> <tr> - <td>&nbsp;</td> <td>open_tab(tab)</td> <td> Opens the tab where the "string" title matches the passed in tab<br /> </td> </tr> - +</table> + +### TableScreen + +*Has all the methods of Screen* + +<table> <tr> - <td>TableScreen</td> - <td>&nbsp;</td> - <td>*Has all the methods of Screen*</td> + <th>Method</th> + <th>Description</th> </tr> <tr> - <td>&nbsp;</td> <td>self</td> <td>Returns the current UITableViewController (not UITableView)</td> </tr> <tr> - <td>&nbsp;</td> <td>searchable(placeholder: "placeholder text")</td> <td>Class method to make the current table searchable.</td> </tr> <tr> - <td>&nbsp;</td> <td colspan="2"> <h3>table_data</h3> Method that is called to get the table's cell data and build the table.<br /> Example format using nearly all available options.<br /> <strong>Note...</strong> if you're getting crazy deep into styling your table cells, @@ -786,20 +759,26 @@ </code></pre> <img src="http://clearsightstudio.github.com/ProMotion/img/ProMotion/full-featured-table-screen.png" /> </td> </tr> <tr> - <td>&nbsp;</td> <td>update_table_data</td> <td> Causes the table data to be refreshed, such as when a remote data source has been downloaded and processed.<br /> </td> </tr> +</table> +### Console + +<table> <tr> - <td>Console</td> + <th>Method</th> + <th>Description</th> + </tr> + <tr> <td>log(log, with_color:color)</td> <td> Class method to output a colored console message.<br /> Example: <code>ProMotion::Console.log("This is red!", with_color: ProMotion::Console::RED_COLOR)</code> </td> @@ -811,5 +790,22 @@ If you need help, feel free to ping me on twitter @jamonholmgren or email jamon@clearsightstudio.com, or open a ticket on GitHub. ## Contributing I'm really looking for feedback. Tweet me with your ideas or open a ticket (I don't mind!) and let's discuss. + +### Submitting a Pull Request + +1. Fork the project +2. Create a feature branch +3. Code +4. Update or create new specs +5. Make sure tests are passing by running `rake spec` +6. Submit pull request + +### Primary Contributors + +* Jamon Holmgren: [@jamonholmgren](https://twitter.com/jamonholmgren) +* Silas Matson: [@silasjmatson](https://twitter.com/silasjmatson) +* Matt Brewer: [@macfanatic](https://twitter.com/macfanatic) + +