lanekit 0.3.5 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +14 -2
- data/lib/lanekit/generate/model.rb +2 -0
- data/lib/lanekit/generate/provider.rb +3 -3
- data/lib/lanekit/generate/tableviewcontroller.rb +110 -0
- data/lib/lanekit/generate.rb +1 -0
- data/lib/lanekit/version.rb +1 -1
- data/lib/lanekit.rb +15 -0
- data/lib/template/LKFeedCell.h.erb +16 -0
- data/lib/template/LKFeedCell.m.erb +148 -0
- data/lib/template/lanekit-ios-project/lanekit-ios-project/lanekit-ios-project/Controllers/LKAppDelegate.m +4 -6
- data/lib/template/lanekit-ios-project/lanekit-ios-project/lanekit-ios-project/Resources/Base.lproj/Main_iPad.storyboard +3 -116
- data/lib/template/lanekit-ios-project/lanekit-ios-project/lanekit-ios-project/Resources/Base.lproj/Main_iPhone.storyboard +4 -82
- data/lib/template/lanekit-ios-project/lanekit-ios-project/lanekit-ios-project/Resources/placeholder@2x.png +0 -0
- data/lib/template/lanekit-ios-project/lanekit-ios-project/lanekit-ios-project.xcodeproj/project.pbxproj +4 -12
- data/lib/template/lanekit-ios-project/lanekit-ios-project.xcworkspace/xcuserdata/larry.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- data/lib/template/model.m.erb +8 -0
- data/lib/template/model_base.h.erb +2 -0
- data/lib/template/model_base.m.erb +30 -0
- data/lib/template/tvc.h.erb +14 -0
- data/lib/template/tvc.m.erb +158 -0
- metadata +14 -12
- data/lib/template/lanekit-ios-project/lanekit-ios-project/lanekit-ios-project/Controllers/LKDetailViewController.h +0 -12
- data/lib/template/lanekit-ios-project/lanekit-ios-project/lanekit-ios-project/Controllers/LKDetailViewController.m +0 -68
- data/lib/template/lanekit-ios-project/lanekit-ios-project/lanekit-ios-project/Controllers/LKMasterViewController.h +0 -13
- data/lib/template/lanekit-ios-project/lanekit-ios-project/lanekit-ios-project/Controllers/LKMasterViewController.m +0 -122
@@ -1,7 +1,8 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="
|
2
|
+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4514" systemVersion="12F45" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="rS3-R9-Ivy">
|
3
3
|
<dependencies>
|
4
|
-
<
|
4
|
+
<deployment defaultVersion="1536" identifier="iOS"/>
|
5
|
+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3746"/>
|
5
6
|
</dependencies>
|
6
7
|
<scenes>
|
7
8
|
<!--Navigation Controller-->
|
@@ -11,89 +12,10 @@
|
|
11
12
|
<navigationBar key="navigationBar" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="yXu-0R-QUA">
|
12
13
|
<autoresizingMask key="autoresizingMask"/>
|
13
14
|
</navigationBar>
|
14
|
-
<connections>
|
15
|
-
<segue destination="pGg-6v-bdr" kind="relationship" relationship="rootViewController" id="RxB-wf-QIq"/>
|
16
|
-
</connections>
|
17
15
|
</navigationController>
|
18
16
|
<placeholder placeholderIdentifier="IBFirstResponder" id="eq9-QA-ai8" sceneMemberID="firstResponder"/>
|
19
17
|
</objects>
|
20
|
-
<point key="canvasLocation" x="-
|
21
|
-
</scene>
|
22
|
-
<!--class Prefix:identifier Master View Controller - Master-->
|
23
|
-
<scene sceneID="VgW-fR-Quf">
|
24
|
-
<objects>
|
25
|
-
<tableViewController title="Master" id="pGg-6v-bdr" customClass="LKMasterViewController" sceneMemberID="viewController">
|
26
|
-
<tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="mLL-gJ-YKr">
|
27
|
-
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
28
|
-
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
29
|
-
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
30
|
-
<prototypes>
|
31
|
-
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" textLabel="2pz-XF-uhl" style="IBUITableViewCellStyleDefault" id="m0d-ak-lc9">
|
32
|
-
<rect key="frame" x="0.0" y="86" width="320" height="44"/>
|
33
|
-
<autoresizingMask key="autoresizingMask"/>
|
34
|
-
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
|
35
|
-
<rect key="frame" x="0.0" y="0.0" width="287" height="43"/>
|
36
|
-
<autoresizingMask key="autoresizingMask"/>
|
37
|
-
<subviews>
|
38
|
-
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="2pz-XF-uhl">
|
39
|
-
<rect key="frame" x="15" y="0.0" width="270" height="43"/>
|
40
|
-
<autoresizingMask key="autoresizingMask"/>
|
41
|
-
<fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
|
42
|
-
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
43
|
-
<color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
44
|
-
</label>
|
45
|
-
</subviews>
|
46
|
-
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
47
|
-
</view>
|
48
|
-
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
49
|
-
<connections>
|
50
|
-
<segue destination="Ah7-4n-0Wa" kind="push" identifier="showDetail" id="jUr-3t-vfg"/>
|
51
|
-
</connections>
|
52
|
-
</tableViewCell>
|
53
|
-
</prototypes>
|
54
|
-
<sections/>
|
55
|
-
<connections>
|
56
|
-
<outlet property="dataSource" destination="pGg-6v-bdr" id="P41-gY-KXY"/>
|
57
|
-
<outlet property="delegate" destination="pGg-6v-bdr" id="Y6K-Cp-Qkv"/>
|
58
|
-
</connections>
|
59
|
-
</tableView>
|
60
|
-
<navigationItem key="navigationItem" title="Master" id="tQt-TN-PWz"/>
|
61
|
-
</tableViewController>
|
62
|
-
<placeholder placeholderIdentifier="IBFirstResponder" id="6Cn-md-YlS" sceneMemberID="firstResponder"/>
|
63
|
-
</objects>
|
64
|
-
<point key="canvasLocation" x="459" y="64"/>
|
65
|
-
</scene>
|
66
|
-
<!--class Prefix:identifier Detail View Controller - Detail-->
|
67
|
-
<scene sceneID="Cn3-H9-jdl">
|
68
|
-
<objects>
|
69
|
-
<viewController title="Detail" id="Ah7-4n-0Wa" customClass="LKDetailViewController" sceneMemberID="viewController">
|
70
|
-
<view key="view" contentMode="scaleToFill" id="MMQ-IT-qOo">
|
71
|
-
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
72
|
-
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
73
|
-
<subviews>
|
74
|
-
<label clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" text="Detail view content goes here" textAlignment="center" lineBreakMode="tailTruncation" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="Lei-5M-9Gs">
|
75
|
-
<rect key="frame" x="20" y="276" width="280" height="17"/>
|
76
|
-
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
77
|
-
<fontDescription key="fontDescription" type="system" size="system"/>
|
78
|
-
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
79
|
-
<nil key="highlightedColor"/>
|
80
|
-
</label>
|
81
|
-
</subviews>
|
82
|
-
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
83
|
-
<constraints>
|
84
|
-
<constraint firstItem="Lei-5M-9Gs" firstAttribute="leading" secondItem="MMQ-IT-qOo" secondAttribute="leading" constant="20" symbolic="YES" id="62x-JV-TTJ"/>
|
85
|
-
<constraint firstItem="Lei-5M-9Gs" firstAttribute="centerY" secondItem="MMQ-IT-qOo" secondAttribute="centerY" id="JzS-HC-Rnl"/>
|
86
|
-
<constraint firstAttribute="trailing" secondItem="Lei-5M-9Gs" secondAttribute="trailing" constant="20" symbolic="YES" id="pXB-RP-Zz6"/>
|
87
|
-
</constraints>
|
88
|
-
</view>
|
89
|
-
<navigationItem key="navigationItem" title="Detail" id="cra-N8-TIN"/>
|
90
|
-
<connections>
|
91
|
-
<outlet property="detailDescriptionLabel" destination="Lei-5M-9Gs" id="sCT-F7-F6f"/>
|
92
|
-
</connections>
|
93
|
-
</viewController>
|
94
|
-
<placeholder placeholderIdentifier="IBFirstResponder" id="lrm-kH-fPn" sceneMemberID="firstResponder"/>
|
95
|
-
</objects>
|
96
|
-
<point key="canvasLocation" x="902" y="64"/>
|
18
|
+
<point key="canvasLocation" x="-305" y="-246"/>
|
97
19
|
</scene>
|
98
20
|
</scenes>
|
99
21
|
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
Binary file
|
@@ -14,10 +14,9 @@
|
|
14
14
|
461263CF180B401300771CF8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 461263CE180B401300771CF8 /* main.m */; };
|
15
15
|
461263D3180B401300771CF8 /* LKAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 461263D2180B401300771CF8 /* LKAppDelegate.m */; };
|
16
16
|
461263D5180B401300771CF8 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 461263D4180B401300771CF8 /* Images.xcassets */; };
|
17
|
-
466CCC20181CA7010028AD47 /* LKDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 466CCC1D181CA7010028AD47 /* LKDetailViewController.m */; };
|
18
|
-
466CCC21181CA7010028AD47 /* LKMasterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 466CCC1F181CA7010028AD47 /* LKMasterViewController.m */; };
|
19
17
|
466CCC26181CA7CA0028AD47 /* Main_iPad.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 466CCC22181CA7CA0028AD47 /* Main_iPad.storyboard */; };
|
20
18
|
466CCC27181CA7CA0028AD47 /* Main_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 466CCC24181CA7CA0028AD47 /* Main_iPhone.storyboard */; };
|
19
|
+
46B91530182595FA00DC8651 /* placeholder@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 46B9152F182595FA00DC8651 /* placeholder@2x.png */; };
|
21
20
|
46C411901824966400B19AB2 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4688500518248B3600EDAAA8 /* SenTestingKit.framework */; };
|
22
21
|
46C411911824966400B19AB2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 461263C2180B401300771CF8 /* Foundation.framework */; };
|
23
22
|
46C411921824966400B19AB2 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 461263C6180B401300771CF8 /* UIKit.framework */; };
|
@@ -49,13 +48,10 @@
|
|
49
48
|
461263D4180B401300771CF8 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = Resources/Images.xcassets; sourceTree = "<group>"; };
|
50
49
|
461263E3180B401300771CF8 /* lanekit-ios-projectTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "lanekit-ios-projectTests-Info.plist"; sourceTree = "<group>"; };
|
51
50
|
461263E5180B401300771CF8 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
52
|
-
466CCC1C181CA7010028AD47 /* LKDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LKDetailViewController.h; path = Controllers/LKDetailViewController.h; sourceTree = "<group>"; };
|
53
|
-
466CCC1D181CA7010028AD47 /* LKDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = LKDetailViewController.m; path = Controllers/LKDetailViewController.m; sourceTree = "<group>"; };
|
54
|
-
466CCC1E181CA7010028AD47 /* LKMasterViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LKMasterViewController.h; path = Controllers/LKMasterViewController.h; sourceTree = "<group>"; };
|
55
|
-
466CCC1F181CA7010028AD47 /* LKMasterViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = LKMasterViewController.m; path = Controllers/LKMasterViewController.m; sourceTree = "<group>"; };
|
56
51
|
466CCC23181CA7CA0028AD47 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Resources/Base.lproj/Main_iPad.storyboard; sourceTree = "<group>"; };
|
57
52
|
466CCC25181CA7CA0028AD47 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Resources/Base.lproj/Main_iPhone.storyboard; sourceTree = "<group>"; };
|
58
53
|
4688500518248B3600EDAAA8 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
|
54
|
+
46B9152F182595FA00DC8651 /* placeholder@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "placeholder@2x.png"; path = "Resources/placeholder@2x.png"; sourceTree = "<group>"; };
|
59
55
|
46C4118F1824966400B19AB2 /* lanekit-ios-projectTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "lanekit-ios-projectTests.octest"; sourceTree = BUILT_PRODUCTS_DIR; };
|
60
56
|
46C411A41824995C00B19AB2 /* lanekit-ios-projectTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "lanekit-ios-projectTests.m"; sourceTree = "<group>"; };
|
61
57
|
46C411A618249A9600B19AB2 /* lanekit-ios-projectTests-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "lanekit-ios-projectTests-Prefix.pch"; sourceTree = "<group>"; };
|
@@ -193,10 +189,6 @@
|
|
193
189
|
children = (
|
194
190
|
461263D1180B401300771CF8 /* LKAppDelegate.h */,
|
195
191
|
461263D2180B401300771CF8 /* LKAppDelegate.m */,
|
196
|
-
466CCC1C181CA7010028AD47 /* LKDetailViewController.h */,
|
197
|
-
466CCC1D181CA7010028AD47 /* LKDetailViewController.m */,
|
198
|
-
466CCC1E181CA7010028AD47 /* LKMasterViewController.h */,
|
199
|
-
466CCC1F181CA7010028AD47 /* LKMasterViewController.m */,
|
200
192
|
);
|
201
193
|
name = Controllers;
|
202
194
|
sourceTree = "<group>";
|
@@ -214,6 +206,7 @@
|
|
214
206
|
466CCC22181CA7CA0028AD47 /* Main_iPad.storyboard */,
|
215
207
|
466CCC24181CA7CA0028AD47 /* Main_iPhone.storyboard */,
|
216
208
|
461263D4180B401300771CF8 /* Images.xcassets */,
|
209
|
+
46B9152F182595FA00DC8651 /* placeholder@2x.png */,
|
217
210
|
);
|
218
211
|
name = Resources;
|
219
212
|
sourceTree = "<group>";
|
@@ -295,6 +288,7 @@
|
|
295
288
|
isa = PBXResourcesBuildPhase;
|
296
289
|
buildActionMask = 2147483647;
|
297
290
|
files = (
|
291
|
+
46B91530182595FA00DC8651 /* placeholder@2x.png in Resources */,
|
298
292
|
466CCC27181CA7CA0028AD47 /* Main_iPhone.storyboard in Resources */,
|
299
293
|
466CCC26181CA7CA0028AD47 /* Main_iPad.storyboard in Resources */,
|
300
294
|
461263CD180B401300771CF8 /* InfoPlist.strings in Resources */,
|
@@ -317,8 +311,6 @@
|
|
317
311
|
isa = PBXSourcesBuildPhase;
|
318
312
|
buildActionMask = 2147483647;
|
319
313
|
files = (
|
320
|
-
466CCC20181CA7010028AD47 /* LKDetailViewController.m in Sources */,
|
321
|
-
466CCC21181CA7010028AD47 /* LKMasterViewController.m in Sources */,
|
322
314
|
461263CF180B401300771CF8 /* main.m in Sources */,
|
323
315
|
461263D3180B401300771CF8 /* LKAppDelegate.m in Sources */,
|
324
316
|
);
|
Binary file
|
data/lib/template/model.m.erb
CHANGED
@@ -47,4 +47,12 @@
|
|
47
47
|
<% end %><% end %> return mapping;
|
48
48
|
}<% end %>
|
49
49
|
|
50
|
+
#pragma mark LKModel overrides
|
51
|
+
|
52
|
+
- (NSString *)descriptionForDisplay
|
53
|
+
{<% if @first_string_attribute %>
|
54
|
+
return [NSString stringWithFormat:@"%@", self.<%=@first_string_attribute%>];<% else %>
|
55
|
+
return [self description];<% end %>
|
56
|
+
}
|
57
|
+
|
50
58
|
@end
|
@@ -74,4 +74,34 @@
|
|
74
74
|
return mapping;
|
75
75
|
}
|
76
76
|
|
77
|
+
+ (NSArray *)allPropertyNames
|
78
|
+
{
|
79
|
+
unsigned count;
|
80
|
+
objc_property_t *propertyList = class_copyPropertyList([self class], &count);
|
81
|
+
|
82
|
+
NSMutableArray *properties = [NSMutableArray array];
|
83
|
+
|
84
|
+
unsigned zz;
|
85
|
+
for (zz=0; zz<count; zz++)
|
86
|
+
{
|
87
|
+
objc_property_t property = propertyList[zz];
|
88
|
+
NSString *name = [NSString stringWithUTF8String:property_getName(property)];
|
89
|
+
[properties addObject:name];
|
90
|
+
}
|
91
|
+
|
92
|
+
free(propertyList);
|
93
|
+
|
94
|
+
return properties.array;
|
95
|
+
}
|
96
|
+
|
97
|
+
{
|
98
|
+
[self valueForKey:propertyName];
|
99
|
+
}
|
100
|
+
|
101
|
+
// Returns the value of one of these properties name, title, headline, displayName, id, or description.
|
102
|
+
- (NSString *)descriptionForDisplay
|
103
|
+
{
|
104
|
+
return [self description];
|
105
|
+
}
|
106
|
+
|
77
107
|
@end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
//
|
2
|
+
// <%=@controller_file_name%>.h
|
3
|
+
//
|
4
|
+
// This model was created on <%=config[:generate_date]%> by LaneKit v<%=config[:lanekit_version]%>.
|
5
|
+
//
|
6
|
+
// The following LaneKit command was used to generate this file:
|
7
|
+
// <%=config[:command]%>
|
8
|
+
//
|
9
|
+
|
10
|
+
#import <UIKit/UIKit.h>
|
11
|
+
|
12
|
+
@interface <%=@controller_class_name%> : UITableViewController
|
13
|
+
|
14
|
+
@end
|
@@ -0,0 +1,158 @@
|
|
1
|
+
//
|
2
|
+
// <%=@controller_file_name%>.m
|
3
|
+
//
|
4
|
+
// This model was created on <%=config[:generate_date]%> by LaneKit v<%=config[:lanekit_version]%>.
|
5
|
+
//
|
6
|
+
// The following LaneKit command was used to generate this file:
|
7
|
+
// <%=config[:command]%>
|
8
|
+
//
|
9
|
+
|
10
|
+
#import "<%=@controller_file_name%>.h"
|
11
|
+
#import "<%=@provider_file_name%>.h"
|
12
|
+
<%if @register_class != "UITableViewCell" %>#import "<%=@register_class%>.h"
|
13
|
+
<%end%>
|
14
|
+
@interface <%=@controller_class_name%> ()
|
15
|
+
@property (nonatomic,strong) NSArray *<%=@model_name%>;
|
16
|
+
- (void)refreshProvider;
|
17
|
+
@end
|
18
|
+
|
19
|
+
@implementation <%=@controller_class_name%>
|
20
|
+
|
21
|
+
- (id)initWithStyle:(UITableViewStyle)style
|
22
|
+
{
|
23
|
+
self = [super initWithStyle:style];
|
24
|
+
if (self) {
|
25
|
+
// Custom initialization
|
26
|
+
}
|
27
|
+
return self;
|
28
|
+
}
|
29
|
+
|
30
|
+
- (void)viewDidLoad
|
31
|
+
{
|
32
|
+
[super viewDidLoad];
|
33
|
+
|
34
|
+
// Uncomment the following line to preserve selection between presentations.
|
35
|
+
// self.clearsSelectionOnViewWillAppear = NO;
|
36
|
+
|
37
|
+
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
|
38
|
+
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
|
39
|
+
|
40
|
+
[self.tableView registerClass:[<%=@register_class%> class] forCellReuseIdentifier:@"Cell"];
|
41
|
+
<%if @register_class != "UITableViewCell" %>
|
42
|
+
self.tableView.rowHeight = <%=@register_class%>.cellHeight;
|
43
|
+
self.tableView.separatorStyle = UITableViewCellSelectionStyleNone;
|
44
|
+
<%end%>
|
45
|
+
UIRefreshControl *refreshControl = UIRefreshControl.new;
|
46
|
+
[refreshControl addTarget:self action:@selector(refreshProvider) forControlEvents:UIControlEventValueChanged];
|
47
|
+
self.refreshControl = refreshControl;
|
48
|
+
|
49
|
+
[self.refreshControl beginRefreshing];
|
50
|
+
[self refreshProvider];
|
51
|
+
}
|
52
|
+
|
53
|
+
- (void)didReceiveMemoryWarning
|
54
|
+
{
|
55
|
+
[super didReceiveMemoryWarning];
|
56
|
+
// Dispose of any resources that can be recreated.
|
57
|
+
}
|
58
|
+
|
59
|
+
- (void)refreshProvider
|
60
|
+
{
|
61
|
+
__unsafe_unretained typeof(self) weakSelf = self;
|
62
|
+
|
63
|
+
<%=@provider_class_name%> *provider = <%=@provider_class_name%>.new;
|
64
|
+
[provider downloadWithCompletionBlock:^(NSError *error, id result) {
|
65
|
+
<%=@model_class_name%> *contents = result;
|
66
|
+
weakSelf.<%=@model_name%> = contents.contents;
|
67
|
+
[weakSelf.refreshControl endRefreshing];
|
68
|
+
[weakSelf.tableView reloadData];
|
69
|
+
}];
|
70
|
+
}
|
71
|
+
|
72
|
+
#pragma mark - Table view data source
|
73
|
+
|
74
|
+
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
75
|
+
{
|
76
|
+
// Return the number of sections.
|
77
|
+
return 1;
|
78
|
+
}
|
79
|
+
|
80
|
+
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
81
|
+
{
|
82
|
+
// Return the number of rows in the section.
|
83
|
+
return self.<%=@model_name%>.count;
|
84
|
+
}
|
85
|
+
|
86
|
+
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
87
|
+
{
|
88
|
+
static NSString *CellIdentifier = @"Cell";
|
89
|
+
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
|
90
|
+
|
91
|
+
// Configure the cell...
|
92
|
+
LKModel *model = [self.<%=@model_name%> objectAtIndex:indexPath.row];
|
93
|
+
cell.textLabel.text = [model descriptionForDisplay];
|
94
|
+
|
95
|
+
if ([model respondsToSelector:@selector(image)] && [cell respondsToSelector:@selector(imageView)])
|
96
|
+
{
|
97
|
+
NSString *imageURL = (NSString *)[(id)model image];
|
98
|
+
if ([imageURL isKindOfClass:[NSString class]])
|
99
|
+
{
|
100
|
+
[cell.imageView setImageWithURL:[NSURL URLWithString:imageURL] placeholderImage:[UIImage imageNamed:@"placeholder"]];
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
return cell;
|
105
|
+
}
|
106
|
+
|
107
|
+
/*
|
108
|
+
// Override to support conditional editing of the table view.
|
109
|
+
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
|
110
|
+
{
|
111
|
+
// Return NO if you do not want the specified item to be editable.
|
112
|
+
return YES;
|
113
|
+
}
|
114
|
+
*/
|
115
|
+
|
116
|
+
/*
|
117
|
+
// Override to support editing the table view.
|
118
|
+
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
|
119
|
+
{
|
120
|
+
if (editingStyle == UITableViewCellEditingStyleDelete) {
|
121
|
+
// Delete the row from the data source
|
122
|
+
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
|
123
|
+
}
|
124
|
+
else if (editingStyle == UITableViewCellEditingStyleInsert) {
|
125
|
+
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
|
126
|
+
}
|
127
|
+
}
|
128
|
+
*/
|
129
|
+
|
130
|
+
/*
|
131
|
+
// Override to support rearranging the table view.
|
132
|
+
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
|
133
|
+
{
|
134
|
+
}
|
135
|
+
*/
|
136
|
+
|
137
|
+
/*
|
138
|
+
// Override to support conditional rearranging of the table view.
|
139
|
+
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
|
140
|
+
{
|
141
|
+
// Return NO if you do not want the item to be re-orderable.
|
142
|
+
return YES;
|
143
|
+
}
|
144
|
+
*/
|
145
|
+
|
146
|
+
/*
|
147
|
+
#pragma mark - Navigation
|
148
|
+
|
149
|
+
// In a story board-based application, you will often want to do a little preparation before navigation
|
150
|
+
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
|
151
|
+
{
|
152
|
+
// Get the new view controller using [segue destinationViewController].
|
153
|
+
// Pass the selected object to the new view controller.
|
154
|
+
}
|
155
|
+
|
156
|
+
*/
|
157
|
+
|
158
|
+
@end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lanekit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Larry Aasen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocoapods
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.25.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.25.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: thor
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,19 +44,19 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.11.1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.11.1
|
55
55
|
description: ! 'LaneKit is an iOS Objective-C code generator for integration with
|
56
56
|
RestKit. It generates
|
57
57
|
|
58
|
-
models, resource providers, and full iOS apps with mimimal effort.
|
59
|
-
for unit testing with SenTestingKit
|
58
|
+
models, resource providers, table views, and full iOS apps with mimimal effort.
|
59
|
+
There is support for unit testing with SenTestingKit
|
60
60
|
|
61
61
|
including fixtures and tests. LaneKit is a command line app written in Ruby and
|
62
62
|
packaged as a Ruby Gem.'
|
@@ -69,12 +69,15 @@ extra_rdoc_files: []
|
|
69
69
|
files:
|
70
70
|
- lib/lanekit/generate/model.rb
|
71
71
|
- lib/lanekit/generate/provider.rb
|
72
|
+
- lib/lanekit/generate/tableviewcontroller.rb
|
72
73
|
- lib/lanekit/generate/urbanairship.rb
|
73
74
|
- lib/lanekit/generate.rb
|
74
75
|
- lib/lanekit/lanefile.rb
|
75
76
|
- lib/lanekit/new.rb
|
76
77
|
- lib/lanekit/version.rb
|
77
78
|
- lib/lanekit.rb
|
79
|
+
- lib/template/LKFeedCell.h.erb
|
80
|
+
- lib/template/LKFeedCell.m.erb
|
78
81
|
- lib/template/model.h.erb
|
79
82
|
- lib/template/model.m.erb
|
80
83
|
- lib/template/model_base.h.erb
|
@@ -88,18 +91,17 @@ files:
|
|
88
91
|
- lib/template/provider.m.erb
|
89
92
|
- lib/template/provider_base.h.erb
|
90
93
|
- lib/template/provider_base.m.erb
|
94
|
+
- lib/template/tvc.h.erb
|
95
|
+
- lib/template/tvc.m.erb
|
91
96
|
- lib/template/lanekit-ios-project/Lanefile
|
92
97
|
- lib/template/lanekit-ios-project/lanekit-ios-project/lanekit-ios-project/Controllers/LKAppDelegate.h
|
93
98
|
- lib/template/lanekit-ios-project/lanekit-ios-project/lanekit-ios-project/Controllers/LKAppDelegate.m
|
94
|
-
- lib/template/lanekit-ios-project/lanekit-ios-project/lanekit-ios-project/Controllers/LKDetailViewController.h
|
95
|
-
- lib/template/lanekit-ios-project/lanekit-ios-project/lanekit-ios-project/Controllers/LKDetailViewController.m
|
96
|
-
- lib/template/lanekit-ios-project/lanekit-ios-project/lanekit-ios-project/Controllers/LKMasterViewController.h
|
97
|
-
- lib/template/lanekit-ios-project/lanekit-ios-project/lanekit-ios-project/Controllers/LKMasterViewController.m
|
98
99
|
- lib/template/lanekit-ios-project/lanekit-ios-project/lanekit-ios-project/Resources/Base.lproj/Main_iPad.storyboard
|
99
100
|
- lib/template/lanekit-ios-project/lanekit-ios-project/lanekit-ios-project/Resources/Base.lproj/Main_iPhone.storyboard
|
100
101
|
- lib/template/lanekit-ios-project/lanekit-ios-project/lanekit-ios-project/Resources/en.lproj/InfoPlist.strings
|
101
102
|
- lib/template/lanekit-ios-project/lanekit-ios-project/lanekit-ios-project/Resources/Images.xcassets/AppIcon.appiconset/Contents.json
|
102
103
|
- lib/template/lanekit-ios-project/lanekit-ios-project/lanekit-ios-project/Resources/Images.xcassets/LaunchImage.launchimage/Contents.json
|
104
|
+
- lib/template/lanekit-ios-project/lanekit-ios-project/lanekit-ios-project/Resources/placeholder@2x.png
|
103
105
|
- lib/template/lanekit-ios-project/lanekit-ios-project/lanekit-ios-project/Supporting
|
104
106
|
Files/lanekit-ios-project-Info.plist
|
105
107
|
- lib/template/lanekit-ios-project/lanekit-ios-project/lanekit-ios-project/Supporting
|
@@ -1,12 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// LKDetailViewController.h
|
3
|
-
//
|
4
|
-
|
5
|
-
#import <UIKit/UIKit.h>
|
6
|
-
|
7
|
-
@interface LKDetailViewController : UIViewController <UISplitViewControllerDelegate>
|
8
|
-
|
9
|
-
@property (strong, nonatomic) id detailItem;
|
10
|
-
|
11
|
-
@property (weak, nonatomic) IBOutlet UILabel *detailDescriptionLabel;
|
12
|
-
@end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// LKDetailViewController.m
|
3
|
-
//
|
4
|
-
|
5
|
-
#import "LKDetailViewController.h"
|
6
|
-
|
7
|
-
@interface LKDetailViewController ()
|
8
|
-
@property (strong, nonatomic) UIPopoverController *masterPopoverController;
|
9
|
-
- (void)configureView;
|
10
|
-
@end
|
11
|
-
|
12
|
-
@implementation LKDetailViewController
|
13
|
-
|
14
|
-
#pragma mark - Managing the detail item
|
15
|
-
|
16
|
-
- (void)setDetailItem:(id)newDetailItem
|
17
|
-
{
|
18
|
-
if (_detailItem != newDetailItem) {
|
19
|
-
_detailItem = newDetailItem;
|
20
|
-
|
21
|
-
// Update the view.
|
22
|
-
[self configureView];
|
23
|
-
}
|
24
|
-
|
25
|
-
if (self.masterPopoverController != nil) {
|
26
|
-
[self.masterPopoverController dismissPopoverAnimated:YES];
|
27
|
-
}
|
28
|
-
}
|
29
|
-
|
30
|
-
- (void)configureView
|
31
|
-
{
|
32
|
-
// Update the user interface for the detail item.
|
33
|
-
|
34
|
-
if (self.detailItem) {
|
35
|
-
self.detailDescriptionLabel.text = [self.detailItem description];
|
36
|
-
}
|
37
|
-
}
|
38
|
-
|
39
|
-
- (void)viewDidLoad
|
40
|
-
{
|
41
|
-
[super viewDidLoad];
|
42
|
-
// Do any additional setup after loading the view, typically from a nib.
|
43
|
-
[self configureView];
|
44
|
-
}
|
45
|
-
|
46
|
-
- (void)didReceiveMemoryWarning
|
47
|
-
{
|
48
|
-
[super didReceiveMemoryWarning];
|
49
|
-
// Dispose of any resources that can be recreated.
|
50
|
-
}
|
51
|
-
|
52
|
-
#pragma mark - Split view
|
53
|
-
|
54
|
-
- (void)splitViewController:(UISplitViewController *)splitController willHideViewController:(UIViewController *)viewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)popoverController
|
55
|
-
{
|
56
|
-
barButtonItem.title = NSLocalizedString(@"Master", @"Master");
|
57
|
-
[self.navigationItem setLeftBarButtonItem:barButtonItem animated:YES];
|
58
|
-
self.masterPopoverController = popoverController;
|
59
|
-
}
|
60
|
-
|
61
|
-
- (void)splitViewController:(UISplitViewController *)splitController willShowViewController:(UIViewController *)viewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem
|
62
|
-
{
|
63
|
-
// Called when the view is shown again in the split view, invalidating the button and popover controller.
|
64
|
-
[self.navigationItem setLeftBarButtonItem:nil animated:YES];
|
65
|
-
self.masterPopoverController = nil;
|
66
|
-
}
|
67
|
-
|
68
|
-
@end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// LKMasterViewController.h
|
3
|
-
//
|
4
|
-
|
5
|
-
#import <UIKit/UIKit.h>
|
6
|
-
|
7
|
-
@class LKDetailViewController;
|
8
|
-
|
9
|
-
@interface LKMasterViewController : UITableViewController
|
10
|
-
|
11
|
-
@property (strong, nonatomic) LKDetailViewController *detailViewController;
|
12
|
-
|
13
|
-
@end
|