ProMotion 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +4 -0
- data/Gemfile +1 -1
- data/ProMotion.gemspec +7 -5
- data/README.md +30 -20
- data/Rakefile +5 -2
- data/lib/ProMotion.rb +9 -3
- data/lib/ProMotion/AppDelegate.rb +7 -0
- data/lib/ProMotion/Screen.rb +11 -0
- data/lib/ProMotion/version.rb +1 -1
- metadata +10 -5
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/ProMotion.gemspec
CHANGED
@@ -2,13 +2,15 @@
|
|
2
2
|
require File.expand_path('../lib/ProMotion/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
|
-
gem.authors = ["Jamon Holmgren"]
|
5
|
+
gem.authors = ["Jamon Holmgren", "Silas Matson", "ClearSight Studio"]
|
6
6
|
gem.email = ["jamon@clearsightstudio.com"]
|
7
|
-
gem.description = "ProMotion is a new way to organize RubyMotion apps."
|
8
|
-
gem.summary = "
|
7
|
+
gem.description = "ProMotion is a new way to organize RubyMotion apps. Currently a proof of concept."
|
8
|
+
gem.summary = "
|
9
|
+
ProMotion is a new way to organize RubyMotion apps. Instead of dealing
|
9
10
|
with UIViewControllers and UIViews, you work with Screens. Screens are
|
10
|
-
a logical way to think of your app.
|
11
|
-
|
11
|
+
a logical way to think of your app -- similar in some ways to Storyboards.
|
12
|
+
"
|
13
|
+
gem.homepage = "https://github.com/clearsightstudio/ProMotion"
|
12
14
|
|
13
15
|
gem.files = `git ls-files`.split($\)
|
14
16
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
data/README.md
CHANGED
@@ -45,13 +45,13 @@ Or install it yourself as:
|
|
45
45
|
|
46
46
|
## Usage
|
47
47
|
|
48
|
-
It's easy to load your first
|
48
|
+
It's easy to load your first screen with a navigation bar (the screen is opened in a UINavigationController behind the scenes):
|
49
49
|
|
50
50
|
```ruby
|
51
|
-
# In /app/app_delegate.rb
|
52
|
-
class AppDelegate
|
51
|
+
# In /app/app_delegate.rb (note that AppDelegate extends ProMotion::AppDelegate)
|
52
|
+
class AppDelegate < ProMotion::AppDelegate
|
53
53
|
def application(application, didFinishLaunchingWithOptions:launchOptions)
|
54
|
-
|
54
|
+
open_with_nav_bar HomeScreen
|
55
55
|
|
56
56
|
true
|
57
57
|
end
|
@@ -66,7 +66,7 @@ class HomeScreen < ProMotion::Screen
|
|
66
66
|
# Set the title for use in nav bars and other containers
|
67
67
|
title "Home"
|
68
68
|
|
69
|
-
# Called when this
|
69
|
+
# Called when this screen is first "opened" and allows you to set up your view components
|
70
70
|
def on_load
|
71
71
|
@default_image = add_image(:default_image, src: "default.png", frame: [10, 50, 100, 100])
|
72
72
|
end
|
@@ -81,7 +81,6 @@ class HomeScreen < ProMotion::Screen
|
|
81
81
|
# Set the title for use in nav bars and other containers
|
82
82
|
title "Home"
|
83
83
|
|
84
|
-
# Called when this view is first "opened" and allows you to set up your view
|
85
84
|
def on_load
|
86
85
|
# Add view items as instance vars so you can access them in other methods
|
87
86
|
|
@@ -100,7 +99,7 @@ class HomeScreen < ProMotion::Screen
|
|
100
99
|
end
|
101
100
|
```
|
102
101
|
|
103
|
-
View
|
102
|
+
View components can be bound to events (like jQuery) and run methods or run a block.
|
104
103
|
|
105
104
|
```ruby
|
106
105
|
# settings_pushed is executed when the button is tapped
|
@@ -117,11 +116,19 @@ end
|
|
117
116
|
@edit_button.on(:tap, :edit_pushed, id: 4)
|
118
117
|
```
|
119
118
|
|
120
|
-
To open other screens, just call
|
119
|
+
To open other screens, just call the built-in "open" method on a new instance or class:
|
121
120
|
|
122
121
|
```ruby
|
123
122
|
def settings_button_tapped
|
124
|
-
|
123
|
+
# ...with a class...
|
124
|
+
open SettingsScreen
|
125
|
+
|
126
|
+
# ...or with an instance...
|
127
|
+
@settings_screen = SettingsScreen.new(some_attr: 4)
|
128
|
+
open @settings_screen
|
129
|
+
|
130
|
+
# ...or if you like...
|
131
|
+
open SettingsScreen.new
|
125
132
|
end
|
126
133
|
```
|
127
134
|
|
@@ -146,7 +153,7 @@ class HomeScreen < ProMotion::Screen
|
|
146
153
|
# ...
|
147
154
|
|
148
155
|
def settings_button_tapped
|
149
|
-
SettingsScreen.
|
156
|
+
open SettingsScreen.new(user_type: "Admin")
|
150
157
|
end
|
151
158
|
end
|
152
159
|
```
|
@@ -156,7 +163,7 @@ When you're done with a screen, just close it:
|
|
156
163
|
```ruby
|
157
164
|
def save_and_close
|
158
165
|
if @model.save
|
159
|
-
|
166
|
+
close
|
160
167
|
end
|
161
168
|
end
|
162
169
|
```
|
@@ -168,7 +175,7 @@ class SettingsScreen < ProMotion::Screen
|
|
168
175
|
# ...
|
169
176
|
|
170
177
|
def save_and_close
|
171
|
-
|
178
|
+
close(saved_changes: true)
|
172
179
|
end
|
173
180
|
end
|
174
181
|
|
@@ -238,7 +245,7 @@ class HomeScreen < ProMotion::Screen
|
|
238
245
|
# Defaults to :normal. :plain_table, :grouped_table are options.
|
239
246
|
screen_type :plain_table
|
240
247
|
|
241
|
-
# Called when this
|
248
|
+
# Called when this screen is first "opened" and allows you to set up your view components
|
242
249
|
def on_load
|
243
250
|
# Add view items as instance vars so you can access them in other methods
|
244
251
|
# This adds a right nav bar button. on_tap allows you to set a method to call when it's tapped.
|
@@ -294,12 +301,12 @@ class HomeScreen < ProMotion::Screen
|
|
294
301
|
# Assuming some sort of ORM, like ParseModel
|
295
302
|
@my_model.save
|
296
303
|
|
297
|
-
# When you want to close the current
|
298
|
-
|
304
|
+
# When you want to close the current screen (usually in a navigation controller), just run this.
|
305
|
+
close
|
299
306
|
|
300
|
-
# You can also pass back arguments to the previous
|
307
|
+
# You can also pass back arguments to the previous screen as you close.
|
301
308
|
# If the previous screen has an `on_return` method, this will be passed into that method
|
302
|
-
|
309
|
+
close(did_stuff: true)
|
303
310
|
end
|
304
311
|
|
305
312
|
# This is called any time a screen "above" this screen is closed. args = {} is required.
|
@@ -312,17 +319,20 @@ class HomeScreen < ProMotion::Screen
|
|
312
319
|
# Custom method
|
313
320
|
def settings_pushed
|
314
321
|
# Just open a settings screen
|
315
|
-
SettingsScreen
|
322
|
+
open SettingsScreen
|
323
|
+
|
324
|
+
# If you prefer to pass in an instance, that works too:
|
325
|
+
open SettingsScreen.new
|
316
326
|
end
|
317
327
|
|
318
328
|
def close_pushed
|
319
|
-
|
329
|
+
close
|
320
330
|
end
|
321
331
|
|
322
332
|
# Custom method with passed in arguments
|
323
333
|
def edit_pushed(args)
|
324
334
|
# Open a screen and set some of its attributes
|
325
|
-
EditScreen.
|
335
|
+
open EditScreen.new(id: args[:id])
|
326
336
|
end
|
327
337
|
end
|
328
338
|
```
|
data/Rakefile
CHANGED
data/lib/ProMotion.rb
CHANGED
@@ -1,5 +1,11 @@
|
|
1
|
+
unless defined?(Motion::Project::Config)
|
2
|
+
raise "This file must be required within a RubyMotion project Rakefile."
|
3
|
+
end
|
4
|
+
|
1
5
|
require "ProMotion/version"
|
2
6
|
|
3
|
-
|
4
|
-
|
5
|
-
|
7
|
+
Motion::Project::App.setup do |app|
|
8
|
+
Dir.glob(File.join(File.dirname(__FILE__), "ProMotion/*.rb")).each do |file|
|
9
|
+
app.files.unshift(file)
|
10
|
+
end
|
11
|
+
end
|
data/lib/ProMotion/version.rb
CHANGED
metadata
CHANGED
@@ -1,17 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ProMotion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jamon Holmgren
|
9
|
+
- Silas Matson
|
10
|
+
- ClearSight Studio
|
9
11
|
autorequire:
|
10
12
|
bindir: bin
|
11
13
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
14
|
+
date: 2012-08-31 00:00:00.000000000 Z
|
13
15
|
dependencies: []
|
14
|
-
description: ProMotion is a new way to organize RubyMotion apps.
|
16
|
+
description: ProMotion is a new way to organize RubyMotion apps. Currently a proof
|
17
|
+
of concept.
|
15
18
|
email:
|
16
19
|
- jamon@clearsightstudio.com
|
17
20
|
executables: []
|
@@ -25,8 +28,10 @@ files:
|
|
25
28
|
- README.md
|
26
29
|
- Rakefile
|
27
30
|
- lib/ProMotion.rb
|
31
|
+
- lib/ProMotion/AppDelegate.rb
|
32
|
+
- lib/ProMotion/Screen.rb
|
28
33
|
- lib/ProMotion/version.rb
|
29
|
-
homepage:
|
34
|
+
homepage: https://github.com/clearsightstudio/ProMotion
|
30
35
|
licenses: []
|
31
36
|
post_install_message:
|
32
37
|
rdoc_options: []
|
@@ -51,5 +56,5 @@ signing_key:
|
|
51
56
|
specification_version: 3
|
52
57
|
summary: ProMotion is a new way to organize RubyMotion apps. Instead of dealing with
|
53
58
|
UIViewControllers and UIViews, you work with Screens. Screens are a logical way
|
54
|
-
to think of your app.
|
59
|
+
to think of your app -- similar in some ways to Storyboards.
|
55
60
|
test_files: []
|