motion_sw_reveal 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d53a9c5cff6c70976ad4ed032983bcd18af1882c
4
+ data.tar.gz: 5e6779ca868d726878b92acaf895595fabaaa80c
5
+ SHA512:
6
+ metadata.gz: 9a2f2c599723355fad848bce037e26fbcd3056a7e28e43495f87a081adcd68f636da872d1eac9ae3d918c5bd01bfb7539bc95c574a105c19218ca3b62cc2b84a
7
+ data.tar.gz: 0b109ee40a6a335f3340be79b2b7f955f3c219fbeb9f68637625a4b00bf5e76e0ce0cc27d5901908046ff9a9d9ad4bc4ad7bdab170538659e7f98d8491eac0be
@@ -0,0 +1,21 @@
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
+ .DS_Store
19
+ /build/
20
+ .repl_history
21
+ vendor/Pods/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in motion_sw_reveal.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Wouter de Vos
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,72 @@
1
+ # MotionSwReveal
2
+
3
+ A ProMotion gem for [SWRevealViewController][swreveal] by [John Lluch][john_lluch],
4
+ heavily inspired on [Promotion Slide Menu][promotion-slide-menu] by [Matt Brewer][matt_brewer] that depends on [PKRevealController][pkrevealcontroller] by [Phillip Kluz][p_kluz]. I could not get
5
+ Promotion Slide Menu working on [RubyMotion][rubymotion] and [ProMotion 1.1+][pro_motion]. I have
6
+ used SWRevealViewController before and I like it's ease of usage. This gem should be easy to use
7
+ as well.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ gem 'motion_sw_reveal'
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install motion_sw_reveal
22
+
23
+ ## Usage
24
+
25
+ Basic use:
26
+
27
+ ```ruby
28
+ # App Delegate
29
+
30
+ def on_load
31
+ # Open a RevealScreen with:
32
+ # - NavigationScreen in the background.
33
+ # - HomeScreen as front screen.
34
+ #
35
+ open_reveal_screen NavigationScreen.new, HomeScreen.new
36
+ end
37
+ ```
38
+
39
+ This opens a new `HomeScreen`. Swiping it to the right will reveal the `NavigationScreen`.
40
+
41
+ If you want a button to show the `NavigationScreen`, just bind an action for it:
42
+
43
+ ```ruby
44
+ # Create a button (I use FontAwesome for the bars icon)
45
+ menu_btn = UIButton.buttonWithType UIButtonTypeRoundedRect
46
+
47
+ add menu_btn, {
48
+ font: FontAwesome.fontWithSize(20.0),
49
+ frame: CGRectMake(0, 0, 30, 30)
50
+ }
51
+
52
+ menu_btn.setTitle FontAwesome.icon('bars'), forState: UIControlStateNormal
53
+
54
+ App.delegate.bind_reveal_screen_button menu_btn
55
+ ```
56
+
57
+ ## Contributing
58
+
59
+ 1. Fork it
60
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
61
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
62
+ 4. Push to the branch (`git push origin my-new-feature`)
63
+ 5. Create new Pull Request
64
+
65
+ [swreveal]: https://github.com/John-Lluch/SWRevealViewController
66
+ [john_lluch]: https://github.com/John-Lluch
67
+ [promotion-slide-menu]: https://github.com/macfanatic/pro_motion_slide_menu
68
+ [matt_brewer]: https://github.com/macfanatic
69
+ [pkrevealcontroller]: https://github.com/pkluz/PKRevealController
70
+ [p_kluz]: https://github.com/pkluz
71
+ [rubymotion]: http://rubymotion.com
72
+ [pro_motion]: https://github.com/clearsightstudio/ProMotion
@@ -0,0 +1,13 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ $:.unshift('/Library/RubyMotion/lib')
4
+ require 'motion/project/template/ios'
5
+ require 'bundler'
6
+ Bundler.require
7
+
8
+ Motion::Project::App.setup do |app|
9
+ # Use `rake config' to see complete project settings.
10
+ app.name = 'MotionSWReveal'
11
+ app.delegate_class = 'TestAppDelegate'
12
+ end
13
+
@@ -0,0 +1,4 @@
1
+ class TestAppDelegate < PM::Delegate
2
+ def on_load(app, options)
3
+ end
4
+ end
@@ -0,0 +1,18 @@
1
+ require 'motion-cocoapods'
2
+ require 'bubble-wrap'
3
+ require 'ProMotion'
4
+
5
+ unless defined?(Motion::Project::Config)
6
+ raise "This file must be required within a RubyMotion project Rakefile."
7
+ end
8
+
9
+ Motion::Project::App.setup do |app|
10
+ Dir.glob(File.join(File.dirname(__FILE__), 'motion_sw_reveal/**/*.rb')).each do |file|
11
+ app.files << file
12
+ end
13
+
14
+ app.pods do
15
+ pod 'SWRevealViewController'
16
+ end
17
+
18
+ end
@@ -0,0 +1,24 @@
1
+ module MotionSWReveal
2
+ module AppDelegate
3
+ def self.included(base)
4
+ base.send :attr_accessor, :reveal_screen
5
+ end
6
+
7
+ def has_reveal_screen?
8
+ !@reveal_screen.nil?
9
+ end
10
+
11
+ def open_reveal_screen(rear, front, options = {})
12
+ @reveal_screen = RevealScreen.new(rear, front, options)
13
+ open @reveal_screen
14
+ @reveal_screen
15
+ end
16
+
17
+ def bind_reveal_screen_button(button)
18
+ button.addTarget(@reveal_screen, action:'revealToggle:',
19
+ forControlEvents:UIControlEventTouchUpInside)
20
+ end
21
+ end
22
+ end
23
+
24
+ PM::Delegate.send :include, MotionSWReveal::AppDelegate
@@ -0,0 +1,72 @@
1
+ module MotionSWReveal
2
+ class RevealScreen < SWRevealViewController
3
+ include ::PM::ScreenModule
4
+
5
+ def self.new(rear, front, options = {})
6
+ reveal_screen = alloc.initWithRearViewController nil, frontViewController: nil
7
+ reveal_screen.set_screens rear: rear, front: front, right: options[:right]
8
+ reveal_screen
9
+ end
10
+
11
+ def set_screens( options = {} )
12
+ options = { animated: false }.merge(options)
13
+
14
+ self.rear_screen = options[:rear] if options[:rear]
15
+ self.right_screen = options[:right] if !options[:right].nil?
16
+ set_front_screen options[:front], options[:animated] if options[:front]
17
+ end
18
+
19
+ def set_front_screen(screen, animated = true)
20
+ screen = prepare_screen_for_pm(screen)
21
+ screen = screen.navigationController || screen
22
+ self.frontViewController = screen
23
+ self.setFrontViewController screen, animated: animated
24
+ bind_gesture_recognizer
25
+ end
26
+
27
+ def front_screen=(screen)
28
+ screen = prepare_screen_for_pm(screen)
29
+ screen = screen.navigationController || screen
30
+ self.frontViewController = screen
31
+ self.setFrontViewController screen, animated: true
32
+ bind_gesture_recognizer
33
+ end
34
+
35
+ def rear_screen=(screen)
36
+ screen = prepare_screen_for_pm(screen)
37
+ screen = screen.navigationController || screen
38
+ self.rearViewController = screen
39
+ end
40
+
41
+ def right_screen=(screen)
42
+ screen = prepare_screen_for_pm(screen)
43
+ screen = screen.navigationController || screen
44
+ self.rightViewController = screen
45
+ end
46
+
47
+ def front_screen
48
+ self.frontViewController
49
+ end
50
+
51
+ def rear_screen
52
+ self.rearViewController
53
+ end
54
+
55
+ def right_screen
56
+ self.rightViewController
57
+ end
58
+
59
+ def bind_gesture_recognizer
60
+ frontViewController.view.addGestureRecognizer self.panGestureRecognizer
61
+ end
62
+
63
+ protected
64
+
65
+ def prepare_screen_for_pm(screen)
66
+ return if screen.nil?
67
+ screen = set_up_screen_for_open(screen, {})
68
+ ensure_wrapper_controller_in_place(screen, {})
69
+ screen
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,3 @@
1
+ module MotionSwReveal
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'motion_sw_reveal/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "motion_sw_reveal"
8
+ spec.version = MotionSwReveal::VERSION
9
+ spec.authors = ["Wouter de Vos"]
10
+ spec.email = ["wouter@springest.com"]
11
+ spec.description = %q{Provides a subclass for presenting side view controllers inspired on the FaceBook and Wunderlist apps, done right!}
12
+ spec.summary = %q{A UIViewController subclass for revealing a rear (left and/or right) view controller behind a front controller, inspired by the Facebook app, done right!}
13
+ spec.homepage = "https://github.com/foxycoder/motion_sw_reveal"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "bubble-wrap"
22
+ spec.add_dependency "motion-cocoapods"
23
+ spec.add_dependency "ProMotion", '~> 1.1'
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.3"
26
+ spec.add_development_dependency "rake"
27
+ spec.add_development_dependency "motion-stump"
28
+ end
@@ -0,0 +1,27 @@
1
+ describe MotionSWReveal::AppDelegate do
2
+
3
+ before do
4
+ @delegate = App.delegate
5
+ end
6
+
7
+ it "should have a 'reveal_screen' attribute" do
8
+ @delegate.respond_to?(:reveal_screen).should == true
9
+ end
10
+
11
+ it "should not have a slide menu by default" do
12
+ @delegate.has_reveal_screen?.should == false
13
+ end
14
+
15
+ it "should respond to 'open_reveal_screen'" do
16
+ @delegate.respond_to?(:open_reveal_screen).should == true
17
+ end
18
+
19
+ it "#open_reveal_screen should return a RevealScreen" do
20
+ @delegate.open_reveal_screen(nil, nil).should.be.instance_of MotionSWReveal::RevealScreen
21
+ end
22
+
23
+ it "should have a RevealScreen as the rootViewController" do
24
+ @delegate.window.rootViewController.should.be.instance_of MotionSWReveal::RevealScreen
25
+ end
26
+
27
+ end
@@ -0,0 +1,2 @@
1
+ class BlankScreen < PM::Screen
2
+ end
@@ -0,0 +1,10 @@
1
+ class LeftNavScreen < PM::TableScreen
2
+ def table_data
3
+ [{
4
+ title: nil,
5
+ cells: [{
6
+ title: 'OVERWRITE THIS METHOD'
7
+ }]
8
+ }]
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ class RightNavScreen < PM::TableScreen
2
+ def table_data
3
+ [{
4
+ title: nil,
5
+ cells: [{
6
+ title: 'OVERWRITE THIS METHOD'
7
+ }]
8
+ }]
9
+ end
10
+ end
@@ -0,0 +1,47 @@
1
+ describe MotionSWReveal::RevealScreen do
2
+
3
+ before do
4
+ @delegate = App.delegate
5
+
6
+ @rear = LeftNavScreen.new
7
+ @right = RightNavScreen.new
8
+ @front = BlankScreen.new
9
+ end
10
+
11
+ it "should return an instance of RevealScreen" do
12
+ screen = MotionSWReveal::RevealScreen.new nil, nil
13
+ screen.should.be.instance_of MotionSWReveal::RevealScreen
14
+ end
15
+
16
+ it "should store rear, front, and right screen controllers" do
17
+ screen = MotionSWReveal::RevealScreen.new @rear, @front, right: @right
18
+ screen.rear_screen.should == @rear
19
+ screen.front_screen.should == @front
20
+ end
21
+
22
+ it "should let me wrap the front screen in a UINavigationController" do
23
+ front_screen = BlankScreen.new(nav_bar: true)
24
+ screen = MotionSWReveal::RevealScreen.new @rear, front_screen
25
+ screen.front_screen.should.be.instance_of PM::NavigationController
26
+ end
27
+
28
+ it "should let me set the title on the front screen during creation" do
29
+ front_screen = BlankScreen.new(title: 'My Title')
30
+ screen = MotionSWReveal::RevealScreen.new @rear, front_screen
31
+ screen.front_screen.title.should == 'My Title'
32
+ end
33
+
34
+ it "should accept a plain UIViewController" do
35
+ screen = MotionSWReveal::RevealScreen.new nil, nil
36
+ should.not.raise(NoMethodError) { screen.rear_screen = UIViewController }
37
+ screen.rear_screen.should.be.instance_of UIViewController
38
+ end
39
+
40
+ it "should allow you to set both a right and rear menu screen" do
41
+ screen = MotionSWReveal::RevealScreen.new @rear, @front, right: @right
42
+ screen.rear_screen.should == @rear
43
+ screen.right_screen.should == @right
44
+ screen.front_screen.should == @front
45
+ end
46
+
47
+ end
@@ -0,0 +1,10 @@
1
+ PODS:
2
+ - SWRevealViewController (1.0.8)
3
+
4
+ DEPENDENCIES:
5
+ - SWRevealViewController
6
+
7
+ SPEC CHECKSUMS:
8
+ SWRevealViewController: 5688d9d017e228c9edd92db359f670d8c47ab8e6
9
+
10
+ COCOAPODS: 0.29.0
metadata ADDED
@@ -0,0 +1,152 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: motion_sw_reveal
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Wouter de Vos
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bubble-wrap
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: motion-cocoapods
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: ProMotion
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.3'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '1.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: motion-stump
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Provides a subclass for presenting side view controllers inspired on
98
+ the FaceBook and Wunderlist apps, done right!
99
+ email:
100
+ - wouter@springest.com
101
+ executables: []
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - .gitignore
106
+ - Gemfile
107
+ - LICENSE.txt
108
+ - README.md
109
+ - Rakefile
110
+ - app/test_app_delegate.rb
111
+ - lib/motion_sw_reveal.rb
112
+ - lib/motion_sw_reveal/app_delegate.rb
113
+ - lib/motion_sw_reveal/reveal_screen.rb
114
+ - lib/motion_sw_reveal/version.rb
115
+ - motion_sw_reveal.gemspec
116
+ - spec/app_delegate_spec.rb
117
+ - spec/helpers/blank_screen.rb
118
+ - spec/helpers/left_nav_screen.rb
119
+ - spec/helpers/right_nav_screen.rb
120
+ - spec/reveal_screen_spec.rb
121
+ - vendor/Podfile.lock
122
+ homepage: https://github.com/foxycoder/motion_sw_reveal
123
+ licenses:
124
+ - MIT
125
+ metadata: {}
126
+ post_install_message:
127
+ rdoc_options: []
128
+ require_paths:
129
+ - lib
130
+ required_ruby_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - '>='
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ required_rubygems_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ requirements: []
141
+ rubyforge_project:
142
+ rubygems_version: 2.0.3
143
+ signing_key:
144
+ specification_version: 4
145
+ summary: A UIViewController subclass for revealing a rear (left and/or right) view
146
+ controller behind a front controller, inspired by the Facebook app, done right!
147
+ test_files:
148
+ - spec/app_delegate_spec.rb
149
+ - spec/helpers/blank_screen.rb
150
+ - spec/helpers/left_nav_screen.rb
151
+ - spec/helpers/right_nav_screen.rb
152
+ - spec/reveal_screen_spec.rb