Skip to content

Commit 38e0cb4

Browse files
committed
Cleaned up Swift variable declaration
1 parent 3ab22cc commit 38e0cb4

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

SwiftyJSONAccelerator/Helpers/JSONHelper.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ open class JSONHelper {
7676
guard let object = passedObject else { return nil }
7777

7878
do {
79-
let data: Data = try JSONSerialization.data(withJSONObject: object, options: JSONSerialization.WritingOptions.prettyPrinted)
79+
let data = try JSONSerialization.data(withJSONObject: object, options: JSONSerialization.WritingOptions.prettyPrinted)
8080
return String.init(data: data, encoding: String.Encoding.utf8)
8181
} catch {
8282
return nil
@@ -93,7 +93,7 @@ open class JSONHelper {
9393
class func reduce(_ items: [JSON]) -> JSON {
9494

9595
return items.reduce([:]) { (source, item) -> JSON in
96-
var finalObject: JSON = source
96+
var finalObject = source
9797
for (key, jsonValue) in item {
9898
if let newValue = jsonValue.dictionary {
9999
finalObject[key] = reduce([JSON(newValue), finalObject[key]])

SwiftyJSONAccelerator/UI/SJEditorViewController.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class SJEditorViewController: NSViewController, NSTextViewDelegate {
157157

158158

159159
func notify(completionState: Bool, fileCount: Int) {
160-
let notification: NSUserNotification = NSUserNotification()
160+
let notification = NSUserNotification()
161161
notification.title = "SwiftyJSONAccelerator"
162162
if completionState && fileCount > 0 {
163163
notification.subtitle = "Completed - \(fileCount) Generated."
@@ -211,15 +211,15 @@ class SJEditorViewController: NSViewController, NSTextViewDelegate {
211211
*/
212212
func handleError(_ error: NSError?) {
213213
if let message = error!.userInfo["debugDescription"] as? String {
214-
let numbers: [String] = message.components(separatedBy: CharacterSet.decimalDigits.inverted)
214+
let numbers = message.components(separatedBy: CharacterSet.decimalDigits.inverted)
215215

216216
var validNumbers: [Int] = []
217217
for number in numbers where (Int(number) != nil) {
218218
validNumbers.append(Int(number)!)
219219
}
220220

221221
if validNumbers.count == 1 {
222-
let index: Int = validNumbers[0]
222+
let index = validNumbers[0]
223223
let errorPosition: (character: String, line: Int, column: Int) = characterRowAndLineAt((textView?.string)!, position: index)
224224
let customErrorMessage = "Error at line number: \(errorPosition.line) column: \(errorPosition.column) at Character: \(errorPosition.character)."
225225
invalidJSONError(customErrorMessage)
@@ -290,7 +290,7 @@ class SJEditorViewController: NSViewController, NSTextViewDelegate {
290290
- returns: Return a valid path or nil.
291291
*/
292292
func openFile() -> String? {
293-
let fileDialog: NSOpenPanel = NSOpenPanel()
293+
let fileDialog = NSOpenPanel()
294294
fileDialog.canChooseFiles = false
295295
fileDialog.canChooseDirectories = true
296296
fileDialog.canCreateDirectories = true

0 commit comments

Comments
 (0)