• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: swift and objective-c
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: swift and objective-c


  • Subject: Re: swift and objective-c
  • From: Marco S Hyman <email@hidden>
  • Date: Sun, 08 Jun 2014 14:50:19 -0700

>> a) -forwardInvocation:
>
> No equivalent — as I said earlier, Swift’s default method dispatch is less dynamic than Obj-C.

I wonder...

forwardInvocation: is invoked by the run time.   If mixing obj-C
and Swift would not the run time invoke a Swift method named
forwardInvocation( anObj: NSInvocation ) if it exists?

Just guessing.

> Without the dynamic lookup of the selector, however, it’s supported with a very elegant & compact syntax:
>
> 	let result = self.methodName?(someObject)

	if let result = self.methodName?(someObject) {
		// handle result here
	}

I think that is the appropriate pattern.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >swift and objective-c (From: "McLaughlin, Michael P." <email@hidden>)
 >Re: swift and objective-c (From: Chris Lattner <email@hidden>)
 >Re: swift and objective-c (From: Andreas Mayer <email@hidden>)
 >Re: swift and objective-c (From: Scott Ribe <email@hidden>)
 >Re: swift and objective-c (From: Andreas Mayer <email@hidden>)

  • Prev by Date: Re: File's owner in nib file
  • Next by Date: Re: Control editor not visible for NSControl subclass
  • Previous by thread: Re: swift and objective-c
  • Next by thread: Re: swift and objective-c
  • Index(es):
    • Date
    • Thread