diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index efb9331..af0500c 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -44,7 +44,7 @@ 8CB3A8DCD4D001A078C276466BCAC054 /* Pods-SwiftyInvocation_Tests-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-SwiftyInvocation_Tests-frameworks.sh"; sourceTree = ""; }; 8DAD7093BA94C9D23DE3ECD5A20CD213 /* Pods_SwiftyInvocation_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwiftyInvocation_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 9347F5FFEB265CFBB27CEA150704CF0B /* Pods-SwiftyInvocation_Tests-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-SwiftyInvocation_Tests-resources.sh"; sourceTree = ""; }; - 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; }; A11F07E4FAD35C7669C5935046E9B803 /* SwiftyInvocation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SwiftyInvocation.swift; sourceTree = ""; }; A12B6CDE1E7B053000F94D8B /* NSObject+SwiftyInvocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+SwiftyInvocation.h"; sourceTree = ""; }; A12B6CDF1E7B053000F94D8B /* NSObject+SwiftyInvocation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+SwiftyInvocation.m"; sourceTree = ""; }; @@ -274,6 +274,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = 7DB346D0F39D3F0E887471402A8071AB; @@ -459,6 +460,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.3; PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; STRIP_INSTALLED_PRODUCT = NO; + SWIFT_VERSION = 5.0; SYMROOT = "${SRCROOT}/../build"; VALIDATE_PRODUCT = YES; }; @@ -504,6 +506,7 @@ ONLY_ACTIVE_ARCH = YES; PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; STRIP_INSTALLED_PRODUCT = NO; + SWIFT_VERSION = 5.0; SYMROOT = "${SRCROOT}/../build"; }; name = Debug; diff --git a/Example/Pods/Pods.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Example/Pods/Pods.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/Example/Pods/Pods.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Example/Pods/Pods.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example/Pods/Pods.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Example/Pods/Pods.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/SwiftyInvocation/Classes/SwiftyInvocation.swift b/SwiftyInvocation/Classes/SwiftyInvocation.swift index 36287c9..f21587d 100644 --- a/SwiftyInvocation/Classes/SwiftyInvocation.swift +++ b/SwiftyInvocation/Classes/SwiftyInvocation.swift @@ -6,6 +6,8 @@ // // +import Foundation + enum SwiftyInvocationError: Error { case noMethod case noImplementation @@ -27,12 +29,11 @@ enum SwiftyInvocationError: Error { /// - selector: The selector of which you want to retrieve the implementation. /// - type: The implementation type in @convention (c) /// - Returns: The implementation -public func swift_getImplementation(object: AnyObject, selector: Selector, type: T.Type) throws -> T { - guard let method = class_getInstanceMethod(type(of: object), selector) else { +public func swift_getImplementation(object: AnyClass, selector: Selector, type: T.Type) throws -> T { + guard let method = class_getInstanceMethod(object, selector) else { throw SwiftyInvocationError.noMethod } - guard let implementation = method_getImplementation(method) else { - throw SwiftyInvocationError.noImplementation - } + + let implementation = method_getImplementation(method) return unsafeBitCast(implementation, to: T.self) }