Skip to content

Commit ef9e6a6

Browse files
committed
Added model generator which works!
1 parent 4246ca2 commit ef9e6a6

File tree

7 files changed

+424
-138
lines changed

7 files changed

+424
-138
lines changed

SwiftyJSONAccelerator.xcodeproj/project.pbxproj

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
9341A14A1BD6E5FE0048CE2C /* SJModelGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9341A1491BD6E5FE0048CE2C /* SJModelGenerator.swift */; settings = {ASSET_TAGS = (); }; };
1111
9341A14C1BD6E6300048CE2C /* SwiftyJSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9341A14B1BD6E6300048CE2C /* SwiftyJSON.swift */; settings = {ASSET_TAGS = (); }; };
1212
9341A14F1BD6E7290048CE2C /* BaseTemplate.txt in Resources */ = {isa = PBXBuildFile; fileRef = 9341A14E1BD6E7290048CE2C /* BaseTemplate.txt */; settings = {ASSET_TAGS = (); }; };
13-
9341A1511BD6E7A60048CE2C /* TestModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9341A1501BD6E7A60048CE2C /* TestModel.swift */; settings = {ASSET_TAGS = (); }; };
1413
9341A1521BD6E9EC0048CE2C /* SwiftyJSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9341A14B1BD6E6300048CE2C /* SwiftyJSON.swift */; settings = {ASSET_TAGS = (); }; };
1514
9361FD141BD18558001ED533 /* LineNumberRulerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9361FD131BD18558001ED533 /* LineNumberRulerView.swift */; settings = {ASSET_TAGS = (); }; };
1615
9362F8661BD07DBA0001372E /* JSONHelperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9362F8651BD07DBA0001372E /* JSONHelperTests.swift */; settings = {ASSET_TAGS = (); }; };
@@ -37,7 +36,6 @@
3736
9341A1491BD6E5FE0048CE2C /* SJModelGenerator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SJModelGenerator.swift; sourceTree = "<group>"; };
3837
9341A14B1BD6E6300048CE2C /* SwiftyJSON.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftyJSON.swift; sourceTree = "<group>"; };
3938
9341A14E1BD6E7290048CE2C /* BaseTemplate.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = BaseTemplate.txt; sourceTree = "<group>"; };
40-
9341A1501BD6E7A60048CE2C /* TestModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestModel.swift; sourceTree = "<group>"; };
4139
9361FD131BD18558001ED533 /* LineNumberRulerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LineNumberRulerView.swift; sourceTree = "<group>"; };
4240
9362F8651BD07DBA0001372E /* JSONHelperTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSONHelperTests.swift; sourceTree = "<group>"; };
4341
93CDE7711BD1A00B00B5B234 /* SJTextView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SJTextView.swift; sourceTree = "<group>"; };
@@ -79,6 +77,15 @@
7977
path = "Base Files";
8078
sourceTree = "<group>";
8179
};
80+
9362D3BC1BD8398A00B927D6 /* External Libraries */ = {
81+
isa = PBXGroup;
82+
children = (
83+
9341A14B1BD6E6300048CE2C /* SwiftyJSON.swift */,
84+
9361FD131BD18558001ED533 /* LineNumberRulerView.swift */,
85+
);
86+
name = "External Libraries";
87+
sourceTree = "<group>";
88+
};
8289
93F174361BD0707D007E7DFC = {
8390
isa = PBXGroup;
8491
children = (
@@ -100,17 +107,16 @@
100107
93F174411BD0707D007E7DFC /* SwiftyJSONAccelerator */ = {
101108
isa = PBXGroup;
102109
children = (
110+
9362D3BC1BD8398A00B927D6 /* External Libraries */,
103111
9341A14D1BD6E6EF0048CE2C /* Base Files */,
104112
93F174421BD0707D007E7DFC /* AppDelegate.swift */,
105113
93F174441BD0707D007E7DFC /* SJEditorViewController.swift */,
106-
9361FD131BD18558001ED533 /* LineNumberRulerView.swift */,
107-
93F174461BD0707D007E7DFC /* Assets.xcassets */,
108-
93F174481BD0707D007E7DFC /* Main.storyboard */,
109-
93F1744B1BD0707D007E7DFC /* Info.plist */,
110114
93F1745F1BD070AA007E7DFC /* JSONHelper.swift */,
111115
93CDE7711BD1A00B00B5B234 /* SJTextView.swift */,
112116
9341A1491BD6E5FE0048CE2C /* SJModelGenerator.swift */,
113-
9341A14B1BD6E6300048CE2C /* SwiftyJSON.swift */,
117+
93F174461BD0707D007E7DFC /* Assets.xcassets */,
118+
93F174481BD0707D007E7DFC /* Main.storyboard */,
119+
93F1744B1BD0707D007E7DFC /* Info.plist */,
114120
);
115121
path = SwiftyJSONAccelerator;
116122
sourceTree = "<group>";
@@ -121,7 +127,6 @@
121127
93F174541BD0707D007E7DFC /* SwiftyJSONAcceleratorTests.swift */,
122128
93F174561BD0707D007E7DFC /* Info.plist */,
123129
9362F8651BD07DBA0001372E /* JSONHelperTests.swift */,
124-
9341A1501BD6E7A60048CE2C /* TestModel.swift */,
125130
);
126131
path = SwiftyJSONAcceleratorTests;
127132
sourceTree = "<group>";
@@ -240,7 +245,6 @@
240245
isa = PBXSourcesBuildPhase;
241246
buildActionMask = 2147483647;
242247
files = (
243-
9341A1511BD6E7A60048CE2C /* TestModel.swift in Sources */,
244248
93F174551BD0707D007E7DFC /* SwiftyJSONAcceleratorTests.swift in Sources */,
245249
9362F8661BD07DBA0001372E /* JSONHelperTests.swift in Sources */,
246250
9341A1521BD6E9EC0048CE2C /* SwiftyJSON.swift in Sources */,

SwiftyJSONAccelerator/AppDelegate.swift

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,20 @@
99
import Cocoa
1010

1111
@NSApplicationMain
12-
class AppDelegate: NSObject, NSApplicationDelegate {
13-
14-
15-
12+
class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDelegate {
13+
1614
func applicationDidFinishLaunching(aNotification: NSNotification) {
17-
// Insert code here to initialize your application
15+
NSUserNotificationCenter.defaultUserNotificationCenter().delegate = self
1816
}
19-
17+
18+
func userNotificationCenter(center: NSUserNotificationCenter, shouldPresentNotification notification: NSUserNotification) -> Bool {
19+
return true
20+
}
21+
2022
func applicationWillTerminate(aNotification: NSNotification) {
2123
// Insert code here to tear down your application
2224
}
23-
24-
25+
26+
2527
}
2628

SwiftyJSONAccelerator/Base Files/BaseTemplate.txt

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,41 @@
22
// {OBJECT_NAME}.swift
33
//
44
// Created by __NAME__ on {DATE}
5-
// Copyright (c) {COMPANY_NAME}. All rights reserved.
5+
// Copyright (c) __MyCompanyName__. All rights reserved.
66
//
77

88
import Foundation
99

10-
public {OBJECT_KIND} {OBJECT_NAME}: Serializable {
10+
public {OBJECT_KIND} {OBJECT_NAME} {
1111

12-
{
13-
14-
STRING_CONSTANT_BLOCK}
15-
16-
17-
// MARK: Declaration for string constants to be used to decode and also serialize.
12+
// MARK: Declaration for string constants to be used to decode and also serialize.
1813
{STRING_CONSTANT_BLOCK}
1914

20-
// MARK: Properties
15+
// MARK: Properties
2116
{PROPERTIES}
2217

23-
/**
24-
Initates the {OBJECT_KIND} based on the object
25-
26-
- parameter object: The object of either Dictionary or Array kind that was passed.
27-
28-
- returns: An initalized instance of the {OBJECT_KIND}.
29-
*/
18+
// MARK: Initalizers
19+
/**
20+
Initates the class based on the object
21+
22+
- parameter object: The object of either Dictionary or Array kind that was passed.
23+
24+
- returns: An initalized instance of the class.
25+
*/
3026
convenience init(object: AnyObject) {
3127
self.init(json: JSON(object))
3228
}
3329

34-
/**
35-
Initates the {OBJECT_KIND} based on the JSON that was passed.
30+
/**
31+
Initates the class based on the JSON that was passed.
32+
33+
- parameter json: JSON object from SwiftyJSON.
34+
35+
- returns: An initalized instance of the class.
36+
*/
37+
init(json: JSON) {
3638

37-
- parameter json: JSON object from SwiftyJSON.
39+
{INITALIZER}
3840

39-
- returns: An initalized instance of the {OBJECT_KIND}.
40-
*/
41-
init(json: JSON) {
42-
4341
}
44-
45-
@end
42+
}

0 commit comments

Comments
 (0)