yptools 1.0.1
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.
- checksums.yaml +7 -0
- data/bin/yptools +4 -0
- data/lib/yptools/help/yp_help.rb +16 -0
- data/lib/yptools/install/mvvm/install-template.sh +15 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/NSObjectObjective-C/___FILEBASENAME___.h +11 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/NSObjectObjective-C/___FILEBASENAME___.m +7 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/NSObjectSwift/___FILEBASENAME___.swift +7 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/TemplateIcon.png +0 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/TemplateIcon@2x.png +0 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/TemplateInfo.plist +224 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UICollectionReusableViewObjective-C/___FILEBASENAME___.h +11 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UICollectionReusableViewObjective-C/___FILEBASENAME___.m +7 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UICollectionReusableViewSwift/___FILEBASENAME___.swift +7 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UICollectionReusableViewXIBObjective-C/___FILEBASENAME___.h +11 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UICollectionReusableViewXIBObjective-C/___FILEBASENAME___.m +12 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UICollectionReusableViewXIBObjective-C/___FILEBASENAME___.xib +17 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UICollectionReusableViewXIBSwift/___FILEBASENAME___.swift +12 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UICollectionReusableViewXIBSwift/___FILEBASENAME___.xib +17 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UICollectionViewCellObjective-C/___FILEBASENAME___.h +11 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UICollectionViewCellObjective-C/___FILEBASENAME___.m +7 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UICollectionViewCellSwift/___FILEBASENAME___.swift +7 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UICollectionViewCellXIBObjective-C/___FILEBASENAME___.h +11 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UICollectionViewCellXIBObjective-C/___FILEBASENAME___.m +12 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UICollectionViewCellXIBObjective-C/___FILEBASENAME___.xib +21 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UICollectionViewCellXIBSwift/___FILEBASENAME___.swift +12 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UICollectionViewCellXIBSwift/___FILEBASENAME___.xib +21 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UICollectionViewControllerObjective-C/___FILEBASENAME___.h +11 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UICollectionViewControllerObjective-C/___FILEBASENAME___.m +87 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UICollectionViewControllerSwift/___FILEBASENAME___.swift +83 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UICollectionViewControllerXIBObjective-C/___FILEBASENAME___.h +11 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UICollectionViewControllerXIBObjective-C/___FILEBASENAME___.m +87 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UICollectionViewControllerXIBObjective-C/___FILEBASENAME___.xib +31 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UICollectionViewControllerXIBSwift/___FILEBASENAME___.swift +83 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UICollectionViewControllerXIBSwift/___FILEBASENAME___.xib +31 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UITableViewCellObjective-C/___FILEBASENAME___.h +11 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UITableViewCellObjective-C/___FILEBASENAME___.m +26 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UITableViewCellSwift/___FILEBASENAME___.swift +18 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UITableViewCellXIBObjective-C/___FILEBASENAME___.h +11 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UITableViewCellXIBObjective-C/___FILEBASENAME___.m +18 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UITableViewCellXIBObjective-C/___FILEBASENAME___.xib +21 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UITableViewCellXIBSwift/___FILEBASENAME___.swift +18 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UITableViewCellXIBSwift/___FILEBASENAME___.xib +21 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UITableViewControllerObjective-C/___FILEBASENAME___.h +11 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UITableViewControllerObjective-C/___FILEBASENAME___.m +87 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UITableViewControllerSwift/___FILEBASENAME___.swift +84 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UITableViewControllerXIBObjective-C/___FILEBASENAME___.h +11 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UITableViewControllerXIBObjective-C/___FILEBASENAME___.m +103 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UITableViewControllerXIBObjective-C/___FILEBASENAME___.xib +26 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UITableViewControllerXIBSwift/___FILEBASENAME___.swift +84 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UITableViewControllerXIBSwift/___FILEBASENAME___.xib +26 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UIViewControllerObjective-C/___FILEBASENAME___.h +11 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UIViewControllerObjective-C/___FILEBASENAME___.m +94 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UIViewControllerObjective-C/___VARIABLE_Proxy___.h +15 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UIViewControllerObjective-C/___VARIABLE_Proxy___.m +39 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UIViewControllerObjective-C/___VARIABLE_TableViewCell___.h +11 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UIViewControllerObjective-C/___VARIABLE_TableViewCell___.m +30 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UIViewControllerObjective-C/___VARIABLE_ViewModel___.h +24 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UIViewControllerObjective-C/___VARIABLE_ViewModel___.m +51 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UIViewControllerSwift/___FILEBASENAME___.swift +24 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UIViewControllerXIBObjective-C/___FILEBASENAME___.h +9 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UIViewControllerXIBObjective-C/___FILEBASENAME___.m +61 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UIViewControllerXIBObjective-C/___FILEBASENAME___.xib +43 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UIViewControllerXIBSwift/___FILEBASENAME___.swift +24 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UIViewControllerXIBSwift/___FILEBASENAME___.xib +22 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UIViewObjective-C/___FILEBASENAME___.h +11 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UIViewObjective-C/___FILEBASENAME___.m +26 -0
- data/lib/yptools/install/mvvm/kMVVM.xctemplate/UIViewSwift/___FILEBASENAME___.swift +15 -0
- data/lib/yptools/install/yp_install.rb +40 -0
- data/lib/yptools/log/yp_log.rb +11 -0
- data/lib/yptools/mgc/yp_makegarbagecode.rb +278 -0
- data/lib/yptools.rb +68 -0
- metadata +156 -0
data/lib/yptools/install/mvvm/kMVVM.xctemplate/UITableViewControllerSwift/___FILEBASENAME___.swift
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
//___FILEHEADER___
|
|
2
|
+
|
|
3
|
+
import UIKit
|
|
4
|
+
|
|
5
|
+
class ___FILEBASENAMEASIDENTIFIER___: ___VARIABLE_cocoaTouchSubclass___ {
|
|
6
|
+
|
|
7
|
+
override func viewDidLoad() {
|
|
8
|
+
super.viewDidLoad()
|
|
9
|
+
|
|
10
|
+
// Uncomment the following line to preserve selection between presentations
|
|
11
|
+
// self.clearsSelectionOnViewWillAppear = false
|
|
12
|
+
|
|
13
|
+
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
|
|
14
|
+
// self.navigationItem.rightBarButtonItem = self.editButtonItem
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// MARK: - Table view data source
|
|
18
|
+
|
|
19
|
+
override func numberOfSections(in tableView: UITableView) -> Int {
|
|
20
|
+
// #warning Incomplete implementation, return the number of sections
|
|
21
|
+
return 0
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
25
|
+
// #warning Incomplete implementation, return the number of rows
|
|
26
|
+
return 0
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/*
|
|
30
|
+
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
31
|
+
let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath)
|
|
32
|
+
|
|
33
|
+
// Configure the cell...
|
|
34
|
+
|
|
35
|
+
return cell
|
|
36
|
+
}
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/*
|
|
40
|
+
// Override to support conditional editing of the table view.
|
|
41
|
+
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
|
|
42
|
+
// Return false if you do not want the specified item to be editable.
|
|
43
|
+
return true
|
|
44
|
+
}
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
/*
|
|
48
|
+
// Override to support editing the table view.
|
|
49
|
+
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
|
|
50
|
+
if editingStyle == .delete {
|
|
51
|
+
// Delete the row from the data source
|
|
52
|
+
tableView.deleteRows(at: [indexPath], with: .fade)
|
|
53
|
+
} else if editingStyle == .insert {
|
|
54
|
+
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
/*
|
|
60
|
+
// Override to support rearranging the table view.
|
|
61
|
+
override func tableView(_ tableView: UITableView, moveRowAt fromIndexPath: IndexPath, to: IndexPath) {
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/*
|
|
67
|
+
// Override to support conditional rearranging of the table view.
|
|
68
|
+
override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool {
|
|
69
|
+
// Return false if you do not want the item to be re-orderable.
|
|
70
|
+
return true
|
|
71
|
+
}
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
/*
|
|
75
|
+
// MARK: - Navigation
|
|
76
|
+
|
|
77
|
+
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
|
78
|
+
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
|
79
|
+
// Get the new view controller using segue.destination.
|
|
80
|
+
// Pass the selected object to the new view controller.
|
|
81
|
+
}
|
|
82
|
+
*/
|
|
83
|
+
|
|
84
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
//___FILEHEADER___
|
|
2
|
+
|
|
3
|
+
#import "___FILEBASENAME___.h"
|
|
4
|
+
|
|
5
|
+
@interface ___FILEBASENAMEASIDENTIFIER___ ()
|
|
6
|
+
|
|
7
|
+
@end
|
|
8
|
+
|
|
9
|
+
@implementation ___FILEBASENAMEASIDENTIFIER___
|
|
10
|
+
|
|
11
|
+
- (void)viewDidLoad {
|
|
12
|
+
[super viewDidLoad];
|
|
13
|
+
|
|
14
|
+
// Uncomment the following line to preserve selection between presentations.
|
|
15
|
+
// self.clearsSelectionOnViewWillAppear = NO;
|
|
16
|
+
|
|
17
|
+
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
|
|
18
|
+
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
#pragma mark - Table view data source
|
|
22
|
+
|
|
23
|
+
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
|
24
|
+
#warning Incomplete implementation, return the number of sections
|
|
25
|
+
return 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
|
29
|
+
#warning Incomplete implementation, return the number of rows
|
|
30
|
+
return 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
35
|
+
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:<#@"reuseIdentifier"#> forIndexPath:indexPath];
|
|
36
|
+
|
|
37
|
+
// Configure the cell...
|
|
38
|
+
|
|
39
|
+
return cell;
|
|
40
|
+
}
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/*
|
|
44
|
+
// Override to support conditional editing of the table view.
|
|
45
|
+
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
46
|
+
// Return NO if you do not want the specified item to be editable.
|
|
47
|
+
return YES;
|
|
48
|
+
}
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
/*
|
|
52
|
+
// Override to support editing the table view.
|
|
53
|
+
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
54
|
+
if (editingStyle == UITableViewCellEditingStyleDelete) {
|
|
55
|
+
// Delete the row from the data source
|
|
56
|
+
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
|
|
57
|
+
} else if (editingStyle == UITableViewCellEditingStyleInsert) {
|
|
58
|
+
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
/*
|
|
64
|
+
// Override to support rearranging the table view.
|
|
65
|
+
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
|
|
66
|
+
}
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
/*
|
|
70
|
+
// Override to support conditional rearranging of the table view.
|
|
71
|
+
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
72
|
+
// Return NO if you do not want the item to be re-orderable.
|
|
73
|
+
return YES;
|
|
74
|
+
}
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
/*
|
|
78
|
+
#pragma mark - Table view delegate
|
|
79
|
+
|
|
80
|
+
// In a xib-based application, navigation from a table can be handled in -tableView:didSelectRowAtIndexPath:
|
|
81
|
+
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
82
|
+
// Navigation logic may go here, for example:
|
|
83
|
+
// Create the next view controller.
|
|
84
|
+
<#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:<#@"Nib name"#> bundle:nil];
|
|
85
|
+
|
|
86
|
+
// Pass the selected object to the new view controller.
|
|
87
|
+
|
|
88
|
+
// Push the view controller.
|
|
89
|
+
[self.navigationController pushViewController:detailViewController animated:YES];
|
|
90
|
+
}
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
/*
|
|
94
|
+
#pragma mark - Navigation
|
|
95
|
+
|
|
96
|
+
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
|
97
|
+
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
|
98
|
+
// Get the new view controller using [segue destinationViewController].
|
|
99
|
+
// Pass the selected object to the new view controller.
|
|
100
|
+
}
|
|
101
|
+
*/
|
|
102
|
+
|
|
103
|
+
@end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13142" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
|
3
|
+
<dependencies>
|
|
4
|
+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12042"/>
|
|
5
|
+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
|
6
|
+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
|
7
|
+
</dependencies>
|
|
8
|
+
<objects>
|
|
9
|
+
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="___FILEBASENAMEASIDENTIFIER___">
|
|
10
|
+
<connections>
|
|
11
|
+
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
|
|
12
|
+
</connections>
|
|
13
|
+
</placeholder>
|
|
14
|
+
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
|
15
|
+
<tableView opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" bouncesZoom="NO" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="i5M-Pr-FkT">
|
|
16
|
+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
|
17
|
+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
|
18
|
+
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
|
19
|
+
<viewLayoutGuide key="safeArea" id="NQg-xp-Ubj"/>
|
|
20
|
+
<connections>
|
|
21
|
+
<outlet property="dataSource" destination="-1" id="Tng-2m-Rnh"/>
|
|
22
|
+
<outlet property="delegate" destination="-1" id="9aC-8N-iBw"/>
|
|
23
|
+
</connections>
|
|
24
|
+
</tableView>
|
|
25
|
+
</objects>
|
|
26
|
+
</document>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
//___FILEHEADER___
|
|
2
|
+
|
|
3
|
+
import UIKit
|
|
4
|
+
|
|
5
|
+
class ___FILEBASENAMEASIDENTIFIER___: ___VARIABLE_cocoaTouchSubclass___ {
|
|
6
|
+
|
|
7
|
+
override func viewDidLoad() {
|
|
8
|
+
super.viewDidLoad()
|
|
9
|
+
|
|
10
|
+
// Uncomment the following line to preserve selection between presentations
|
|
11
|
+
// self.clearsSelectionOnViewWillAppear = false
|
|
12
|
+
|
|
13
|
+
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
|
|
14
|
+
// self.navigationItem.rightBarButtonItem = self.editButtonItem
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// MARK: - Table view data source
|
|
18
|
+
|
|
19
|
+
override func numberOfSections(in tableView: UITableView) -> Int {
|
|
20
|
+
// #warning Incomplete implementation, return the number of sections
|
|
21
|
+
return 0
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
25
|
+
// #warning Incomplete implementation, return the number of rows
|
|
26
|
+
return 0
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/*
|
|
30
|
+
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
31
|
+
let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath)
|
|
32
|
+
|
|
33
|
+
// Configure the cell...
|
|
34
|
+
|
|
35
|
+
return cell
|
|
36
|
+
}
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/*
|
|
40
|
+
// Override to support conditional editing of the table view.
|
|
41
|
+
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
|
|
42
|
+
// Return false if you do not want the specified item to be editable.
|
|
43
|
+
return true
|
|
44
|
+
}
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
/*
|
|
48
|
+
// Override to support editing the table view.
|
|
49
|
+
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
|
|
50
|
+
if editingStyle == .delete {
|
|
51
|
+
// Delete the row from the data source
|
|
52
|
+
tableView.deleteRows(at: [indexPath], with: .fade)
|
|
53
|
+
} else if editingStyle == .insert {
|
|
54
|
+
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
/*
|
|
60
|
+
// Override to support rearranging the table view.
|
|
61
|
+
override func tableView(_ tableView: UITableView, moveRowAt fromIndexPath: IndexPath, to: IndexPath) {
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/*
|
|
67
|
+
// Override to support conditional rearranging of the table view.
|
|
68
|
+
override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool {
|
|
69
|
+
// Return false if you do not want the item to be re-orderable.
|
|
70
|
+
return true
|
|
71
|
+
}
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
/*
|
|
75
|
+
// MARK: - Navigation
|
|
76
|
+
|
|
77
|
+
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
|
78
|
+
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
|
79
|
+
// Get the new view controller using segue.destination.
|
|
80
|
+
// Pass the selected object to the new view controller.
|
|
81
|
+
}
|
|
82
|
+
*/
|
|
83
|
+
|
|
84
|
+
}
|
data/lib/yptools/install/mvvm/kMVVM.xctemplate/UITableViewControllerXIBSwift/___FILEBASENAME___.xib
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13142" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
|
3
|
+
<dependencies>
|
|
4
|
+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12042"/>
|
|
5
|
+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
|
6
|
+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
|
7
|
+
</dependencies>
|
|
8
|
+
<objects>
|
|
9
|
+
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="___FILEBASENAMEASIDENTIFIER___" customModuleProvider="target">
|
|
10
|
+
<connections>
|
|
11
|
+
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
|
|
12
|
+
</connections>
|
|
13
|
+
</placeholder>
|
|
14
|
+
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
|
15
|
+
<tableView opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" bouncesZoom="NO" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="i5M-Pr-FkT">
|
|
16
|
+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
|
17
|
+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
|
18
|
+
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
|
19
|
+
<viewLayoutGuide key="safeArea" id="vLr-E1-eTs"/>
|
|
20
|
+
<connections>
|
|
21
|
+
<outlet property="dataSource" destination="-1" id="Tng-2m-Rnh"/>
|
|
22
|
+
<outlet property="delegate" destination="-1" id="9aC-8N-iBw"/>
|
|
23
|
+
</connections>
|
|
24
|
+
</tableView>
|
|
25
|
+
</objects>
|
|
26
|
+
</document>
|
data/lib/yptools/install/mvvm/kMVVM.xctemplate/UIViewControllerObjective-C/___FILEBASENAME___.m
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
//___FILEHEADER___
|
|
2
|
+
|
|
3
|
+
#import "___FILEBASENAME___.h"
|
|
4
|
+
#import "___VARIABLE_ViewModel___.h"
|
|
5
|
+
#import "___VARIABLE_Proxy___.h"
|
|
6
|
+
#import "___VARIABLE_TableViewCell___.h"
|
|
7
|
+
#import "Masonry.h"
|
|
8
|
+
|
|
9
|
+
@interface ___FILEBASENAMEASIDENTIFIER___ () <___VARIABLE_ViewModel___Delegate>
|
|
10
|
+
|
|
11
|
+
@property (nonatomic, strong) UITableView *tableView;
|
|
12
|
+
@property (nonatomic, strong) ___VARIABLE_ViewModel___ *viewModel;
|
|
13
|
+
@property (nonatomic, strong) ___VARIABLE_Proxy___ *proxy;
|
|
14
|
+
|
|
15
|
+
@end
|
|
16
|
+
|
|
17
|
+
@implementation ___FILEBASENAMEASIDENTIFIER___
|
|
18
|
+
|
|
19
|
+
- (void)viewDidLoad {
|
|
20
|
+
[super viewDidLoad];
|
|
21
|
+
// Do any additional setup after loading the view.
|
|
22
|
+
|
|
23
|
+
[self setupSubviews];
|
|
24
|
+
[self startLoadData];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
- (void)startLoadData {
|
|
28
|
+
[self.viewModel startLoadData];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
- (void)setupSubviews {
|
|
32
|
+
[self.view addSubview:self.tableView];
|
|
33
|
+
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
34
|
+
make.left.right.bottom.equalTo(self.view);
|
|
35
|
+
make.top.equalTo(self.view);
|
|
36
|
+
}];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
#pragma mark - ___VARIABLE_ViewModel___Delegate
|
|
40
|
+
|
|
41
|
+
- (void)didEndLoadData:(BOOL)hasMore {
|
|
42
|
+
[self.tableView.mj_header endRefreshing];
|
|
43
|
+
[self.tableView.mj_footer endRefreshing];
|
|
44
|
+
if (hasMore) {
|
|
45
|
+
[self.tableView.mj_footer resetNoMoreData];
|
|
46
|
+
} else {
|
|
47
|
+
[self.tableView.mj_footer endRefreshingWithNoMoreData];
|
|
48
|
+
}
|
|
49
|
+
[self.tableView reloadData];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
#pragma mark - getters | setters
|
|
53
|
+
|
|
54
|
+
- (UITableView *)tableView {
|
|
55
|
+
if (!_tableView) {
|
|
56
|
+
UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
|
57
|
+
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
|
58
|
+
tableView.showsHorizontalScrollIndicator = NO;
|
|
59
|
+
tableView.showsVerticalScrollIndicator = NO;
|
|
60
|
+
tableView.delegate = self.proxy;
|
|
61
|
+
tableView.dataSource = self.proxy;
|
|
62
|
+
NSArray *classs = @[
|
|
63
|
+
[UITableViewCell class],
|
|
64
|
+
[___VARIABLE_TableViewCell___ class],
|
|
65
|
+
];
|
|
66
|
+
[classs enumerateObjectsUsingBlock:^(Class _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
67
|
+
[tableView registerClass:obj forCellReuseIdentifier:NSStringFromClass(obj)];
|
|
68
|
+
}];
|
|
69
|
+
NSArray *headersClasss = @[
|
|
70
|
+
];
|
|
71
|
+
[headersClasss enumerateObjectsUsingBlock:^(Class _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
72
|
+
[tableView registerClass:obj forHeaderFooterViewReuseIdentifier:NSStringFromClass(obj)];
|
|
73
|
+
}];
|
|
74
|
+
_tableView = tableView;
|
|
75
|
+
}
|
|
76
|
+
return _tableView;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
- (___VARIABLE_Proxy___ *)proxy {
|
|
80
|
+
if (!_proxy) {
|
|
81
|
+
_proxy = [[___VARIABLE_Proxy___ alloc] initWithViewModel:self.viewModel];
|
|
82
|
+
}
|
|
83
|
+
return _proxy;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
- (___VARIABLE_ViewModel___ *)viewModel {
|
|
87
|
+
if (!_viewModel) {
|
|
88
|
+
_viewModel = [[___VARIABLE_ViewModel___ alloc] init];
|
|
89
|
+
_viewModel.delegate = self;
|
|
90
|
+
}
|
|
91
|
+
return _viewModel;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@end
|
data/lib/yptools/install/mvvm/kMVVM.xctemplate/UIViewControllerObjective-C/___VARIABLE_Proxy___.h
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//___FILEHEADER___
|
|
2
|
+
|
|
3
|
+
___IMPORTHEADER_cocoaTouchSubclass___
|
|
4
|
+
|
|
5
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
6
|
+
|
|
7
|
+
@class ___VARIABLE_ViewModel___;
|
|
8
|
+
|
|
9
|
+
@interface ___FILEBASENAMEASIDENTIFIER___ : NSObject <UITableViewDelegate,UITableViewDataSource>
|
|
10
|
+
|
|
11
|
+
- (instancetype)initWithViewModel:(___VARIABLE_ViewModel___ *)viewModel;
|
|
12
|
+
|
|
13
|
+
@end
|
|
14
|
+
|
|
15
|
+
NS_ASSUME_NONNULL_END
|
data/lib/yptools/install/mvvm/kMVVM.xctemplate/UIViewControllerObjective-C/___VARIABLE_Proxy___.m
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//___FILEHEADER___
|
|
2
|
+
|
|
3
|
+
#import "___FILEBASENAME___.h"
|
|
4
|
+
#import "___VARIABLE_ViewModel___.h"
|
|
5
|
+
#import "___VARIABLE_TableViewCell___.h"
|
|
6
|
+
|
|
7
|
+
@interface ___FILEBASENAMEASIDENTIFIER___ ()
|
|
8
|
+
|
|
9
|
+
@property (nonatomic, weak) ___VARIABLE_ViewModel___ *viewModel;
|
|
10
|
+
|
|
11
|
+
@end
|
|
12
|
+
|
|
13
|
+
@implementation ___FILEBASENAMEASIDENTIFIER___
|
|
14
|
+
|
|
15
|
+
- (instancetype)initWithViewModel:(___VARIABLE_ViewModel___ *)viewModel {
|
|
16
|
+
if (self = [self init]) {
|
|
17
|
+
self.viewModel = viewModel;
|
|
18
|
+
}
|
|
19
|
+
return self;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
#pragma mark - UITableViewDelegate,UITableViewDataSource
|
|
23
|
+
|
|
24
|
+
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
25
|
+
___VARIABLE_TableViewCell___ *cell = [tableView dequeueReusableCellWithIdentifier:@"___VARIABLE_TableViewCell___"];
|
|
26
|
+
cell.textLabel.text = self.viewModel.dataList[indexPath.row];
|
|
27
|
+
return cell;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
|
31
|
+
return self.viewModel.dataList.count;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
35
|
+
CGFloat height = 44.f;
|
|
36
|
+
return height;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//___FILEHEADER___
|
|
2
|
+
|
|
3
|
+
#import "___FILEBASENAME___.h"
|
|
4
|
+
|
|
5
|
+
@interface ___FILEBASENAMEASIDENTIFIER___ ()
|
|
6
|
+
|
|
7
|
+
@end
|
|
8
|
+
|
|
9
|
+
@implementation ___FILEBASENAMEASIDENTIFIER___
|
|
10
|
+
|
|
11
|
+
- (instancetype)initWithStyle:(UITableViewCellStyle)style
|
|
12
|
+
reuseIdentifier:(NSString *)reuseIdentifier {
|
|
13
|
+
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
|
|
14
|
+
if (self) {
|
|
15
|
+
self.selectionStyle = UITableViewCellSelectionStyleDefault;
|
|
16
|
+
self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
|
|
17
|
+
[self setupSubViews];
|
|
18
|
+
}
|
|
19
|
+
return self;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
- (void)setupSubViews{
|
|
23
|
+
//to do
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
- (void)layoutSubviews{
|
|
27
|
+
[super layoutSubviews];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//___FILEHEADER___
|
|
2
|
+
|
|
3
|
+
___IMPORTHEADER_cocoaTouchSubclass___
|
|
4
|
+
|
|
5
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
6
|
+
|
|
7
|
+
@protocol ___FILEBASENAMEASIDENTIFIER___Delegate <NSObject>
|
|
8
|
+
|
|
9
|
+
- (void)didEndLoadData:(BOOL)hasMore;
|
|
10
|
+
|
|
11
|
+
@end
|
|
12
|
+
|
|
13
|
+
@interface ___FILEBASENAMEASIDENTIFIER___ : NSObject
|
|
14
|
+
|
|
15
|
+
@property (nonatomic, weak) id <___FILEBASENAMEASIDENTIFIER___Delegate> delegate;
|
|
16
|
+
@property (nonatomic, readonly) NSMutableArray *dataList;
|
|
17
|
+
|
|
18
|
+
- (void)startLoadData;
|
|
19
|
+
|
|
20
|
+
- (void)loadMoreData;
|
|
21
|
+
|
|
22
|
+
@end
|
|
23
|
+
|
|
24
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//___FILEHEADER___
|
|
2
|
+
|
|
3
|
+
#import "___FILEBASENAME___.h"
|
|
4
|
+
|
|
5
|
+
@interface ___FILEBASENAMEASIDENTIFIER___ ()
|
|
6
|
+
|
|
7
|
+
@property (nonatomic, strong) NSMutableArray *dataList;
|
|
8
|
+
|
|
9
|
+
@end
|
|
10
|
+
|
|
11
|
+
@implementation ___FILEBASENAMEASIDENTIFIER___ {
|
|
12
|
+
NSInteger _pageSize;
|
|
13
|
+
NSInteger _pageIndex;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
- (instancetype)init {
|
|
17
|
+
if (self = [super init]) {
|
|
18
|
+
_pageSize = 10;
|
|
19
|
+
_pageIndex = 1;
|
|
20
|
+
self.dataList = [[NSMutableArray alloc] init];
|
|
21
|
+
}
|
|
22
|
+
return self;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
- (void)startLoadData {
|
|
26
|
+
_pageIndex = 1;
|
|
27
|
+
[self startLoadingData:_pageIndex];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
- (void)loadMoreData {
|
|
31
|
+
_pageIndex ++;
|
|
32
|
+
[self startLoadingData:_pageIndex];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
- (void)startLoadingData:(NSInteger)pageIndex {
|
|
36
|
+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
37
|
+
BOOL hasMore = YES;
|
|
38
|
+
if (_pageIndex > 3) {
|
|
39
|
+
hasMore = NO;
|
|
40
|
+
}
|
|
41
|
+
if (_pageIndex == 1) {
|
|
42
|
+
[self.dataList removeAllObjects];
|
|
43
|
+
}
|
|
44
|
+
[self.dataList addObjectsFromArray:[[UIFont familyNames] subarrayWithRange:NSMakeRange(self.dataList.count, _pageSize)]];
|
|
45
|
+
if ([self.delegate respondsToSelector:@selector(didEndLoadData:)]) {
|
|
46
|
+
[self.delegate didEndLoadData:hasMore];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//___FILEHEADER___
|
|
2
|
+
|
|
3
|
+
import UIKit
|
|
4
|
+
|
|
5
|
+
class ___FILEBASENAMEASIDENTIFIER___: ___VARIABLE_cocoaTouchSubclass___ {
|
|
6
|
+
|
|
7
|
+
override func viewDidLoad() {
|
|
8
|
+
super.viewDidLoad()
|
|
9
|
+
|
|
10
|
+
// Do any additional setup after loading the view.
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
// MARK: - Navigation
|
|
16
|
+
|
|
17
|
+
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
|
18
|
+
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
|
19
|
+
// Get the new view controller using segue.destination.
|
|
20
|
+
// Pass the selected object to the new view controller.
|
|
21
|
+
}
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
}
|