> On Oct 5, 2016, at 14:43, Jens Alfke via swift-users <swift-users@swift.org> 
> wrote:
> 
> 
>> On Oct 5, 2016, at 1:50 PM, Bob Miller via swift-users 
>> <swift-users@swift.org> wrote:
>> 
>>      This is a Swift3 newbie question that I’ve not found a solution to. Has 
>> there been any consensus reached on an equivalent approach to the AppKit 
>> class NSInvocation ? Here’s a simple objC example.
> 
> Swift doesn’t have an equivalent because the language simply isn’t as dynamic 
> as Objective-C: there is no mechanism to invoke a method at runtime given its 
> name.
> 
> If you’re on an Apple platform, and the method you want to call, and its 
> class, are @objc — then you can literally use NSInvocation from Swift to do 
> this. But not otherwise.

However, there are usually better answers than NSInvocation (both in Swift and 
Objective-C). What are you actually trying to do?

Jordan

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to