Skip to content

Commit 54c5aa0

Browse files
committed
Updated code formatting
1 parent d9b5003 commit 54c5aa0

File tree

10 files changed

+552
-329
lines changed

10 files changed

+552
-329
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "0700"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "93F1743E1BD0707D007E7DFC"
18+
BuildableName = "SwiftyJSONAccelerator.app"
19+
BlueprintName = "SwiftyJSONAccelerator"
20+
ReferencedContainer = "container:SwiftyJSONAccelerator.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
<TestableReference
32+
skipped = "NO">
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "93F1744F1BD0707D007E7DFC"
36+
BuildableName = "SwiftyJSONAccelerator.xctest"
37+
BlueprintName = "SwiftyJSONAcceleratorTests"
38+
ReferencedContainer = "container:SwiftyJSONAccelerator.xcodeproj">
39+
</BuildableReference>
40+
</TestableReference>
41+
</Testables>
42+
<MacroExpansion>
43+
<BuildableReference
44+
BuildableIdentifier = "primary"
45+
BlueprintIdentifier = "93F1743E1BD0707D007E7DFC"
46+
BuildableName = "SwiftyJSONAccelerator.app"
47+
BlueprintName = "SwiftyJSONAccelerator"
48+
ReferencedContainer = "container:SwiftyJSONAccelerator.xcodeproj">
49+
</BuildableReference>
50+
</MacroExpansion>
51+
<AdditionalOptions>
52+
</AdditionalOptions>
53+
</TestAction>
54+
<LaunchAction
55+
buildConfiguration = "Debug"
56+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
57+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
58+
launchStyle = "0"
59+
useCustomWorkingDirectory = "NO"
60+
ignoresPersistentStateOnLaunch = "NO"
61+
debugDocumentVersioning = "YES"
62+
debugServiceExtension = "internal"
63+
allowLocationSimulation = "YES">
64+
<BuildableProductRunnable
65+
runnableDebuggingMode = "0">
66+
<BuildableReference
67+
BuildableIdentifier = "primary"
68+
BlueprintIdentifier = "93F1743E1BD0707D007E7DFC"
69+
BuildableName = "SwiftyJSONAccelerator.app"
70+
BlueprintName = "SwiftyJSONAccelerator"
71+
ReferencedContainer = "container:SwiftyJSONAccelerator.xcodeproj">
72+
</BuildableReference>
73+
</BuildableProductRunnable>
74+
<AdditionalOptions>
75+
</AdditionalOptions>
76+
</LaunchAction>
77+
<ProfileAction
78+
buildConfiguration = "Release"
79+
shouldUseLaunchSchemeArgsEnv = "YES"
80+
savedToolIdentifier = ""
81+
useCustomWorkingDirectory = "NO"
82+
debugDocumentVersioning = "YES">
83+
<BuildableProductRunnable
84+
runnableDebuggingMode = "0">
85+
<BuildableReference
86+
BuildableIdentifier = "primary"
87+
BlueprintIdentifier = "93F1743E1BD0707D007E7DFC"
88+
BuildableName = "SwiftyJSONAccelerator.app"
89+
BlueprintName = "SwiftyJSONAccelerator"
90+
ReferencedContainer = "container:SwiftyJSONAccelerator.xcodeproj">
91+
</BuildableReference>
92+
</BuildableProductRunnable>
93+
</ProfileAction>
94+
<AnalyzeAction
95+
buildConfiguration = "Debug">
96+
</AnalyzeAction>
97+
<ArchiveAction
98+
buildConfiguration = "Release"
99+
revealArchiveInOrganizer = "YES">
100+
</ArchiveAction>
101+
</Scheme>

SwiftyJSONAccelerator/AppDelegate.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,18 @@ import Cocoa
1010

1111
@NSApplicationMain
1212
class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDelegate {
13-
13+
1414
func applicationDidFinishLaunching(aNotification: NSNotification) {
1515
NSUserNotificationCenter.defaultUserNotificationCenter().delegate = self
1616
}
17-
17+
1818
func userNotificationCenter(center: NSUserNotificationCenter, shouldPresentNotification notification: NSUserNotification) -> Bool {
1919
return true
2020
}
21-
21+
2222
func applicationWillTerminate(aNotification: NSNotification) {
2323
// Insert code here to tear down your application
2424
}
25-
26-
27-
}
2825

26+
27+
}

SwiftyJSONAccelerator/Base Files/BaseTemplate.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import Foundation
99

10-
public {OBJECT_KIND} {OBJECT_NAME} {
10+
public {OBJECT_KIND} {OBJECT_NAME}: NSObject, NSCoding {
1111

1212
// MARK: Declaration for string constants to be used to decode and also serialize.
1313
{STRING_CONSTANT_BLOCK}
@@ -23,7 +23,7 @@ public {OBJECT_KIND} {OBJECT_NAME} {
2323

2424
- returns: An initalized instance of the class.
2525
*/
26-
convenience init(object: AnyObject) {
26+
convenience public init(object: AnyObject) {
2727
self.init(json: JSON(object))
2828
}
2929

@@ -34,7 +34,7 @@ public {OBJECT_KIND} {OBJECT_NAME} {
3434

3535
- returns: An initalized instance of the class.
3636
*/
37-
init(json: JSON) {
37+
public init(json: JSON) {
3838

3939
{INITALIZER}
4040

@@ -45,7 +45,7 @@ public {OBJECT_KIND} {OBJECT_NAME} {
4545
{DECODERS}
4646
}
4747

48-
func encodeWithCoder(aCoder: NSCoder) {
48+
public func encodeWithCoder(aCoder: NSCoder) {
4949
{ENCODERS}
5050
}
5151

SwiftyJSONAccelerator/Base.lproj/Main.storyboard

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -670,11 +670,11 @@
670670
<objects>
671671
<viewController title="SwiftyJSONAccelerator" id="XfG-lQ-9wD" customClass="SJEditorViewController" customModule="SwiftyJSONAccelerator" customModuleProvider="target" sceneMemberID="viewController">
672672
<view key="view" id="m2S-Jp-Qdl">
673-
<rect key="frame" x="0.0" y="0.0" width="593" height="554"/>
673+
<rect key="frame" x="0.0" y="0.0" width="717" height="599"/>
674674
<autoresizingMask key="autoresizingMask"/>
675675
<subviews>
676676
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="AwX-MF-DMD">
677-
<rect key="frame" x="377" y="97" width="212" height="36"/>
677+
<rect key="frame" x="501" y="97" width="212" height="36"/>
678678
<constraints>
679679
<constraint firstAttribute="width" constant="200" id="Fsx-eV-1MY"/>
680680
</constraints>
@@ -688,22 +688,22 @@
688688
</connections>
689689
</button>
690690
<scrollView horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Gmg-Tp-PPn">
691-
<rect key="frame" x="0.0" y="136" width="593" height="418"/>
691+
<rect key="frame" x="0.0" y="136" width="717" height="463"/>
692692
<clipView key="contentView" id="V7d-R1-cDN">
693-
<rect key="frame" x="1" y="1" width="591" height="416"/>
693+
<rect key="frame" x="1" y="1" width="715" height="461"/>
694694
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
695695
<subviews>
696696
<textView importsGraphics="NO" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" usesRuler="YES" usesFontPanel="YES" verticallyResizable="YES" allowsNonContiguousLayout="YES" quoteSubstitution="YES" dashSubstitution="YES" spellingCorrection="YES" smartInsertDelete="YES" id="fWl-7Q-Cq6" customClass="SJTextView" customModule="SwiftyJSONAccelerator" customModuleProvider="target">
697-
<rect key="frame" x="0.0" y="0.0" width="591" height="416"/>
697+
<rect key="frame" x="0.0" y="0.0" width="715" height="461"/>
698698
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
699699
<animations/>
700700
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
701701
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
702-
<size key="minSize" width="591" height="416"/>
703-
<size key="maxSize" width="593" height="10000000"/>
702+
<size key="minSize" width="715" height="461"/>
703+
<size key="maxSize" width="715" height="10000000"/>
704704
<color key="insertionPointColor" name="controlLightHighlightColor" catalog="System" colorSpace="catalog"/>
705-
<size key="minSize" width="591" height="416"/>
706-
<size key="maxSize" width="593" height="10000000"/>
705+
<size key="minSize" width="715" height="461"/>
706+
<size key="maxSize" width="715" height="10000000"/>
707707
</textView>
708708
</subviews>
709709
<animations/>
@@ -716,7 +716,7 @@
716716
<animations/>
717717
</scroller>
718718
<scroller key="verticalScroller" verticalHuggingPriority="750" horizontal="NO" id="9fh-RH-upi">
719-
<rect key="frame" x="576" y="1" width="16" height="416"/>
719+
<rect key="frame" x="700" y="1" width="16" height="461"/>
720720
<autoresizingMask key="autoresizingMask"/>
721721
<animations/>
722722
</scroller>
@@ -731,7 +731,7 @@
731731
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" animates="YES" imageScaling="proportionallyDown" image="failure" id="CKF-pW-DBY"/>
732732
</imageView>
733733
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="GbJ-FJ-Uuc">
734-
<rect key="frame" x="41" y="103" width="336" height="26"/>
734+
<rect key="frame" x="41" y="103" width="460" height="26"/>
735735
<constraints>
736736
<constraint firstAttribute="height" constant="26" id="WGF-kR-SB9"/>
737737
</constraints>
@@ -743,7 +743,7 @@
743743
</textFieldCell>
744744
</textField>
745745
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aJ1-yn-Pl7">
746-
<rect key="frame" x="13" y="77" width="568" height="22"/>
746+
<rect key="frame" x="13" y="77" width="692" height="22"/>
747747
<animations/>
748748
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" title="BaseClass" placeholderString="Base Class Name" bezelStyle="round" id="vuP-t4-ep6">
749749
<font key="font" metaFont="system"/>
@@ -752,7 +752,7 @@
752752
</textFieldCell>
753753
</textField>
754754
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="b3c-Wz-v36">
755-
<rect key="frame" x="13" y="53" width="568" height="22"/>
755+
<rect key="frame" x="13" y="53" width="692" height="22"/>
756756
<animations/>
757757
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="Class Prefix (For example, NS)" bezelStyle="round" id="N8s-m9-cf7">
758758
<font key="font" metaFont="system"/>
@@ -761,7 +761,7 @@
761761
</textFieldCell>
762762
</textField>
763763
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="sNu-7Z-F06">
764-
<rect key="frame" x="13" y="29" width="568" height="22"/>
764+
<rect key="frame" x="13" y="29" width="692" height="22"/>
765765
<animations/>
766766
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="Company name" bezelStyle="round" id="76e-Gm-0jI">
767767
<font key="font" metaFont="system"/>
@@ -770,7 +770,7 @@
770770
</textFieldCell>
771771
</textField>
772772
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="mJg-3P-2Aw">
773-
<rect key="frame" x="13" y="5" width="568" height="22"/>
773+
<rect key="frame" x="13" y="5" width="692" height="22"/>
774774
<animations/>
775775
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="Author name" bezelStyle="round" id="jUe-0u-QLL">
776776
<font key="font" metaFont="system"/>
@@ -820,7 +820,7 @@
820820
</viewController>
821821
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
822822
</objects>
823-
<point key="canvasLocation" x="89.5" y="614"/>
823+
<point key="canvasLocation" x="151.5" y="636.5"/>
824824
</scene>
825825
</scenes>
826826
<resources>

SwiftyJSONAccelerator/JSONHelper.swift

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,34 @@ import Foundation
1010

1111
/// Provides helpers to handle JSON content that user provides.
1212
public class JSONHelper {
13-
13+
1414
/**
1515
Validates if te string that is provided can be converted into a valid JSON.
16-
16+
1717
- parameters:
18-
- jsonString: Input string that is to be checked as JSON.
19-
18+
- jsonString: Input string that is to be checked as JSON.
19+
2020
- returns: Bool indicating if it is a JSON or NSError with the error about the validation.
2121
*/
2222
public class func isStringValidJSON(jsonString: String?) -> (Bool, NSError?) {
2323
let response = convertToObject(jsonString)
2424
return (response.0, response.2)
2525
}
26-
26+
2727
/**
2828
Converts the given string into an Object.
29-
29+
3030
- parameters:
31-
- jsonString: Input string that has to be converted.
32-
31+
- jsonString: Input string that has to be converted.
32+
3333
- returns: Bool indicating if the process was successful, Object if it worked else NSError.
3434
*/
3535
public class func convertToObject(jsonString: String?) -> (Bool, AnyObject?, NSError?) {
36-
36+
3737
if jsonString == nil {
3838
return (false, nil, nil)
3939
}
40-
40+
4141
let jsonData = jsonString!.dataUsingEncoding(NSUTF8StringEncoding)!
4242
do {
4343
let object = try NSJSONSerialization.JSONObjectWithData(jsonData, options: NSJSONReadingOptions.AllowFragments)
@@ -47,13 +47,13 @@ public class JSONHelper {
4747
return (false, nil, error)
4848
}
4949
}
50-
50+
5151
/**
5252
Formats the given string into beautiful JSON with indentation.
53-
53+
5454
- parameters:
55-
- jsonString: JSON string that has to be formatted.
56-
55+
- jsonString: JSON string that has to be formatted.
56+
5757
- returns: String with JSON but well formatted.
5858
*/
5959
public class func prettyJSON(jsonString: String?) -> String? {
@@ -67,26 +67,26 @@ public class JSONHelper {
6767

6868
/**
6969
Formats the given Object into beautiful JSON with indentation.
70-
70+
7171
- parameters:
72-
- object: Object that has to be formatted.
73-
72+
- object: Object that has to be formatted.
73+
7474
- returns: String with JSON but well formatted.
7575
*/
7676
public class func prettyJSON(object: AnyObject?) -> String? {
77-
77+
7878
if object == nil {
7979
return nil
8080
}
81-
81+
8282
do {
83-
let data: NSData = try NSJSONSerialization.dataWithJSONObject(object!, options: NSJSONWritingOptions.PrettyPrinted)
83+
let data: NSData = try NSJSONSerialization.dataWithJSONObject(object!, options: NSJSONWritingOptions.PrettyPrinted)
8484
return String.init(data: data, encoding: NSUTF8StringEncoding)
8585
}
8686
catch _ as NSError {
8787
return nil
8888
}
8989
}
90-
91-
90+
91+
9292
}

0 commit comments

Comments
 (0)