88
99import Foundation
1010
11- typealias ImplementationBlock = @convention ( block) ( ) -> Void
12-
1311/// An object that allows you to introspect and modify classes through the ObjC runtime.
14- public class ObjectiveClass < T: NSObject > : ObjectiveKitRuntimeModification {
12+ public class ObjectiveClass < T: NSObject > : ObjectiveKitRuntimeModification {
1513
1614 public var internalClass : AnyClass
1715
@@ -33,7 +31,7 @@ public class ObjectiveClass <T: NSObject>: ObjectiveKitRuntimeModification {
3331 var ivars = [ String] ( )
3432 let ivarList = class_copyIvarList ( internalClass, & count)
3533 for i in ( 0 ..< Int ( count) ) {
36- let unwrapped = ivarList ? [ i] . unsafelyUnwrapped
34+ let unwrapped = ( ivarList ? [ i] ) . unsafelyUnwrapped
3735 if let ivar = ivar_getName ( unwrapped) {
3836 let string = String ( cString: ivar)
3937 ivars. append ( string)
@@ -44,7 +42,6 @@ public class ObjectiveClass <T: NSObject>: ObjectiveKitRuntimeModification {
4442 }
4543 }
4644
47-
4845 /// Get all selectors implemented by the class.
4946 ///
5047 /// - Returns: An array of selectors.
@@ -54,8 +51,8 @@ public class ObjectiveClass <T: NSObject>: ObjectiveKitRuntimeModification {
5451 var selectors = [ Selector] ( )
5552 let methodList = class_copyMethodList ( internalClass, & count)
5653 for i in ( 0 ..< Int ( count) ) {
57- let unwrapped = methodList ? [ i] . unsafelyUnwrapped
58- if let selector = method_getName ( unwrapped) {
54+ if let unwrapped = methodList ? [ i] {
55+ let selector = method_getName ( unwrapped)
5956 selectors. append ( selector)
6057 }
6158 }
@@ -73,8 +70,8 @@ public class ObjectiveClass <T: NSObject>: ObjectiveKitRuntimeModification {
7370 var protocols = [ String] ( )
7471 let protocolList = class_copyProtocolList ( internalClass, & count)
7572 for i in ( 0 ..< Int ( count) ) {
76- let unwrapped = protocolList ? [ i] . unsafelyUnwrapped
77- if let protocolName = protocol_getName ( unwrapped) {
73+ if let unwrapped = protocolList ? [ i] {
74+ let protocolName = protocol_getName ( unwrapped)
7875 let string = String ( cString: protocolName)
7976 protocols. append ( string)
8077 }
@@ -92,8 +89,8 @@ public class ObjectiveClass <T: NSObject>: ObjectiveKitRuntimeModification {
9289 var properties = [ String] ( )
9390 let propertyList = class_copyPropertyList ( internalClass, & count)
9491 for i in ( 0 ..< Int ( count) ) {
95- let unwrapped = propertyList ? [ i] . unsafelyUnwrapped
96- if let propretyName = property_getName ( unwrapped) {
92+ if let unwrapped = propertyList ? [ i] {
93+ let propretyName = property_getName ( unwrapped)
9794 let string = String ( cString: propretyName)
9895 properties. append ( string)
9996 }
@@ -102,7 +99,4 @@ public class ObjectiveClass <T: NSObject>: ObjectiveKitRuntimeModification {
10299 return properties
103100 }
104101 }
105-
106102}
107-
108-
0 commit comments