Re: Assigning an element of a swift array to a userdata parameter triggers didSet
Re: Assigning an element of a swift array to a userdata parameter triggers didSet
- Subject: Re: Assigning an element of a swift array to a userdata parameter triggers didSet
- From: Jens Alfke <email@hidden>
- Date: Wed, 18 Nov 2015 10:57:24 -0800
> On Nov 18, 2015, at 10:17 AM, Quincey Morris <email@hidden> wrote:
>
> If the array element (a dictionary, in your original post) is small enough, you can pass a pointer to a copy of the element instead of a pointer to the element. That is:
>
> var myElement = myArray[0]
> view.addToolTipRect( NSMakeRect( 0, 0, 100, 100), owner: self, userData: &myElement )
Doesn’t the pointer become invalid as soon as myElement goes out of scope? (There’s a reason that type is called *Unsafe*Pointer…)
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden