Skip to content

Commit 2fb076d

Browse files
committed
#3 cleaned code
1 parent 2c124af commit 2fb076d

File tree

3 files changed

+143
-154
lines changed

3 files changed

+143
-154
lines changed

SwiftyJSONAccelerator/Base.lproj/Main.storyboard

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="9059" systemVersion="15A282b" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
2+
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="9059" systemVersion="15A284" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
33
<dependencies>
44
<deployment identifier="macosx"/>
55
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9059"/>
@@ -699,10 +699,10 @@
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="700" height="461"/>
702+
<size key="minSize" width="715" height="461"/>
703703
<size key="maxSize" width="717" height="10000000"/>
704704
<color key="insertionPointColor" name="controlLightHighlightColor" catalog="System" colorSpace="catalog"/>
705-
<size key="minSize" width="700" height="461"/>
705+
<size key="minSize" width="715" height="461"/>
706706
<size key="maxSize" width="717" height="10000000"/>
707707
</textView>
708708
</subviews>
@@ -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="701" y="1" width="15" height="461"/>
719+
<rect key="frame" x="700" y="1" width="16" height="461"/>
720720
<autoresizingMask key="autoresizingMask"/>
721721
<animations/>
722722
</scroller>

SwiftyJSONAccelerator/SJEditorViewController.swift

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ class SJEditorViewController: NSViewController, NSTextViewDelegate {
4949
}
5050

5151
/**
52-
Validates and updates the textview.
52+
Validates and updates the textview.
5353

54-
- parameter pretty: If the JSON is to be pretty printed.
54+
- parameter pretty: If the JSON is to be pretty printed.
5555

56-
- returns: if the format was valid.
57-
*/
56+
- returns: if the format was valid.
57+
*/
5858
func validateAndFormat(pretty: Bool) -> Bool {
5959

6060
if textView?.string?.characters.count == 0 {
@@ -80,8 +80,8 @@ class SJEditorViewController: NSViewController, NSTextViewDelegate {
8080
}
8181

8282
/**
83-
Actual function that generates the model.
84-
*/
83+
Actual function that generates the model.
84+
*/
8585
func generateModel() {
8686

8787
// The base class field is blank, cannot proceed without it. Possibly can have a default value in the future.
@@ -106,9 +106,9 @@ class SJEditorViewController: NSViewController, NSTextViewDelegate {
106106

107107
let swiftyState = self.includeSwiftyCheckbox?.state == 1 ? true : false
108108
let supportSwiftyState = self.supportSwiftyJSONCheckbox?.state == 1 ? true : false
109-
109+
110110
let nscodingState = self.supportNSCodingCheckbox?.state == 1 ? true : false
111-
111+
112112
let objectMapperState = self.includeObjectMapperCheckbox?.state == 1 ? true : false
113113
let supportObjectMapperState = self.supportObjectMapperCheckbox?.state == 1 ? true : false
114114

@@ -122,7 +122,7 @@ class SJEditorViewController: NSViewController, NSTextViewDelegate {
122122
}
123123

124124
@IBAction func recalcEnabledBoxes(sender: AnyObject) {
125-
125+
126126
let supportSwiftyState = self.supportSwiftyJSONCheckbox?.state == 1 ? true : false
127127
let supportObjectMapperState = self.supportObjectMapperCheckbox?.state == 1 ? true : false
128128

@@ -132,15 +132,15 @@ class SJEditorViewController: NSViewController, NSTextViewDelegate {
132132
else {
133133
self.includeSwiftyCheckbox?.enabled = false
134134
}
135-
135+
136136
if supportObjectMapperState {
137137
self.includeObjectMapperCheckbox?.enabled = true
138138
}
139139
else {
140140
self.includeObjectMapperCheckbox?.enabled = false
141141
}
142142
}
143-
143+
144144
// MARK: Internal Methods
145145

146146
/**
@@ -177,11 +177,11 @@ class SJEditorViewController: NSViewController, NSTextViewDelegate {
177177
}
178178

179179
/**
180-
Handle Error message that is provided by the JSON helper and extract the message and showing them accordingly.
180+
Handle Error message that is provided by the JSON helper and extract the message and showing them accordingly.
181181

182-
- parameters:
183-
- error: NSError that was provided.
184-
*/
182+
- parameters:
183+
- error: NSError that was provided.
184+
*/
185185
func handleError(error: NSError?) {
186186
if let _ = error!.userInfo["debugDescription"] as? String? {
187187
let message: String = error!.userInfo["NSDebugDescription"]! as! String
@@ -214,19 +214,19 @@ class SJEditorViewController: NSViewController, NSTextViewDelegate {
214214
}
215215

216216
/**
217-
Show that the JSON is fine with proper icon.
218-
*/
217+
Show that the JSON is fine with proper icon.
218+
*/
219219
func correctJSONMessage() {
220220
errorImageView?.image = NSImage.init(named: "success")
221221
messageLabel?.stringValue = "Valid JSON!"
222222
}
223223

224224
/**
225-
Show the invalid JSON error with proper error and message.
225+
Show the invalid JSON error with proper error and message.
226226

227-
- parameters:
228-
- message: Error message that is to be shown.
229-
*/
227+
- parameters:
228+
- message: Error message that is to be shown.
229+
*/
230230
func invalidJSONError(message: String) {
231231
errorImageView?.image = NSImage.init(named: "failure")
232232
messageLabel?.stringValue = message

0 commit comments

Comments
 (0)