motion-generators 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b6ff30494193e2c28e39e5858500e69ab70cc93
|
4
|
+
data.tar.gz: 8d4005150553ec767611efd5cdbaffdea2aa29fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80ac0d4d79d1c1c023d7ed05072407192b9263fbd311ae1698fd92da14e125d41399bc2f6eba6af973bc1fa67f8282d99ecd9d252f5f090893e7943aa1be9cae
|
7
|
+
data.tar.gz: 916a3b30a95df55edf32a9747f6fd34736f02f8dcbe8e6b5f29b624d7449e118e504bc8783d131c909b6bb1b2429c283b8a95d2ad716b69fbbc941ce75de797d
|
data/lib/motion/generate.rb
CHANGED
@@ -26,7 +26,23 @@ module Motion
|
|
26
26
|
def ui_view_controller(name)
|
27
27
|
@name = name
|
28
28
|
@class_name = "%sController" % @name.camelize
|
29
|
-
template "ui_view_controller.rb.erb",
|
29
|
+
template "ui_view_controller.rb.erb",
|
30
|
+
"app/controllers/#{name.underscorize}_controller.rb"
|
31
|
+
end
|
32
|
+
|
33
|
+
option :name
|
34
|
+
option :parent_class, {
|
35
|
+
desc: "The name of the class to inherit from",
|
36
|
+
aliases: ["-p", "--parent"],
|
37
|
+
default: "UICollectionViewController",
|
38
|
+
type: :string,
|
39
|
+
}
|
40
|
+
desc "ui_collection_view_controller", "Creates a UICollectionViewController subclass in app/controllers"
|
41
|
+
def ui_collection_view_controller(name)
|
42
|
+
@name = name
|
43
|
+
@class_name = "%sController" % @name.camelize
|
44
|
+
template "ui_collection_view_controller.rb.erb",
|
45
|
+
"app/controllers/#{name.underscore}_controller.rb"
|
30
46
|
end
|
31
47
|
|
32
48
|
option :name
|
@@ -40,7 +56,8 @@ module Motion
|
|
40
56
|
def ui_table_view_controller(name)
|
41
57
|
@name = name
|
42
58
|
@class_name = "%sController" % @name.camelize
|
43
|
-
template "ui_table_view_controller.rb.erb",
|
59
|
+
template "ui_table_view_controller.rb.erb",
|
60
|
+
"app/controllers/#{name.underscorize}_controller.rb"
|
44
61
|
end
|
45
62
|
|
46
63
|
option :name
|
@@ -54,9 +71,24 @@ module Motion
|
|
54
71
|
def ui_table_view_cell(name)
|
55
72
|
@name = name
|
56
73
|
@class_name = "%sCell" % @name.camelize
|
57
|
-
template "ui_table_view_cell.rb.erb",
|
74
|
+
template "ui_table_view_cell.rb.erb",
|
75
|
+
"app/views/table_cells/#{name.underscorize}_cell.rb"
|
58
76
|
end
|
59
77
|
|
78
|
+
option :name
|
79
|
+
option :parent_class, {
|
80
|
+
desc: "The name of the class to inherit from",
|
81
|
+
aliases: ["-p", "--parent"],
|
82
|
+
default: "UICollectionViewCell",
|
83
|
+
type: :string,
|
84
|
+
}
|
85
|
+
desc "ui_collection_view_cell", "Creates a UICollectionViewCell subclass in app/view/collection_cells"
|
86
|
+
def ui_collection_view_cell(name)
|
87
|
+
@name = name
|
88
|
+
@class_name = "%sCell" % @name.camelize
|
89
|
+
template "ui_table_view_cell.rb.erb",
|
90
|
+
"app/views/table_cells/#{name.underscore}_cell.rb"
|
91
|
+
end
|
60
92
|
|
61
93
|
private
|
62
94
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class <%= class_name %> < <%= parent_class_name %>
|
2
|
+
|
3
|
+
|
4
|
+
attr_accessor :<%= singular_name %>
|
5
|
+
|
6
|
+
|
7
|
+
def prepare_for_<%= singular_name %>(<%= singular_name %>)
|
8
|
+
self.<%= singular_name %> = <%= singular_name %>
|
9
|
+
# Set up cell here
|
10
|
+
end
|
11
|
+
|
12
|
+
# def prepareForReuse
|
13
|
+
# super
|
14
|
+
# end
|
15
|
+
|
16
|
+
# def awakeFromNib
|
17
|
+
# super
|
18
|
+
# end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
class <%= class_name %> < <%= parent_class_name %>
|
2
|
+
|
3
|
+
|
4
|
+
# ==================
|
5
|
+
# = View Lifecycle =
|
6
|
+
# ==================
|
7
|
+
|
8
|
+
|
9
|
+
# def viewDidLoad
|
10
|
+
# super
|
11
|
+
# end
|
12
|
+
|
13
|
+
# def viewWillAppear(animated)
|
14
|
+
# super
|
15
|
+
# end
|
16
|
+
|
17
|
+
# def viewDidAppear(animated)
|
18
|
+
# super
|
19
|
+
# end
|
20
|
+
|
21
|
+
# def viewWillDisappear(animated)
|
22
|
+
# super
|
23
|
+
# end
|
24
|
+
|
25
|
+
# def viewDidDisappear(animated)
|
26
|
+
# super
|
27
|
+
# end
|
28
|
+
|
29
|
+
# ===========
|
30
|
+
# = Actions =
|
31
|
+
# ===========
|
32
|
+
|
33
|
+
# Define your custom actions here...
|
34
|
+
|
35
|
+
# ============================
|
36
|
+
# = UICollectionViewDelegate =
|
37
|
+
# ============================
|
38
|
+
|
39
|
+
# Asks the delegate if the specified item should be selected.
|
40
|
+
def collectionView collection_view, shouldSelectItemAtIndexPath: index_path
|
41
|
+
end
|
42
|
+
|
43
|
+
# Tells the delegate that the item at the specified index path was selected.
|
44
|
+
def collectionView collection_view, didSelectItemAtIndexPath: index_path
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
# Tells the delegate that the specified cell is about to be displayed in the collection view.
|
49
|
+
def collectionView collection_view, willDisplayCell:cell, forItemAtIndexPath: index_path
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
# =========================
|
56
|
+
# = UITableViewDataSource =
|
57
|
+
# =========================
|
58
|
+
|
59
|
+
def collectionView(collection_view, numberOfItemsInSection: section)
|
60
|
+
end
|
61
|
+
|
62
|
+
def numberOfSectionsInCollectionView(collection_view)
|
63
|
+
end
|
64
|
+
|
65
|
+
def collectionView(collection_view, cellForItemAtIndexPath: index_path)
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
# ===========
|
70
|
+
# = Private =
|
71
|
+
# ===========
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
|
76
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-generators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bodacious
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -87,6 +87,8 @@ files:
|
|
87
87
|
- lib/motion/generate.rb
|
88
88
|
- lib/motion/generators.rb
|
89
89
|
- lib/motion/generators/version.rb
|
90
|
+
- lib/motion/templates/ui_collection_view_cell.rb.erb
|
91
|
+
- lib/motion/templates/ui_collection_view_controller.rb.erb
|
90
92
|
- lib/motion/templates/ui_table_view_cell.rb.erb
|
91
93
|
- lib/motion/templates/ui_table_view_controller.rb.erb
|
92
94
|
- lib/motion/templates/ui_view_controller.rb.erb
|