From 2a7c18f36ce4c2e4300632a25b5d88bad3e08ca1 Mon Sep 17 00:00:00 2001 From: CoderXpert Date: Sat, 19 Nov 2016 22:20:46 +0000 Subject: [PATCH] Refactor to avoid nesting by using guard + by removing some unnecessary `{}` --- ObjectiveKit/ObjectiveClass.swift | 88 +++++++++++++------------------ ObjectiveKit/RuntimeClass.swift | 19 ++++--- 2 files changed, 47 insertions(+), 60 deletions(-) diff --git a/ObjectiveKit/ObjectiveClass.swift b/ObjectiveKit/ObjectiveClass.swift index a9cd787..a9fedeb 100644 --- a/ObjectiveKit/ObjectiveClass.swift +++ b/ObjectiveKit/ObjectiveClass.swift @@ -28,20 +28,17 @@ public class ObjectiveClass : ObjectiveKitRuntimeModification { /// /// - Returns: An array of instance variables. public var ivars: [String] { - get { - var count: CUnsignedInt = 0 - var ivars = [String]() - let ivarList = class_copyIvarList(internalClass, &count) - for i in (0..: ObjectiveKitRuntimeModification { /// /// - Returns: An array of selectors. public var selectors: [Selector] { - get { - var count: CUnsignedInt = 0 - var selectors = [Selector]() - let methodList = class_copyMethodList(internalClass, &count) - for i in (0.. String { switch self { - case .NSString: return "@" - case .NSObject: return "@" - case .Float: return "f" - case .Int: return "i" - case .Double: return "d" - case .Void: return "v" + case .NSString: return "@" + case .NSObject: return "@" + case .Float: return "f" + case .Int: return "i" + case .Double: return "d" + case .Void: return "v" } }