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: Charles Srstka <email@hidden>
- Date: Wed, 18 Nov 2015 13:26:02 -0600
> On Nov 18, 2015, at 7:24 AM, Eric Gorr <email@hidden <mailto:email@hidden>> wrote:
>
> Yes, that all makes sense. So, the question is what can I do about it? The number of tooltips I need is the same number of elements in the array and the number of elements in the array can change over the lifetime of the application. So, it is natural to store the information needed by the tooltip inside of an array and pass a pointer to an array element as the userdata for the tooltip. If my current implementation is not going to work, what is the recommended implementation for this kind of behavior?
How about creating a context object or struct, with a single property to which you assign a copy of the array (or, alternatively, a computed property that dynamically returns the contents of the array)? Then you’re not making an UnsafePointer of the array itself, and it probably shouldn’t get unnecessarily assigned to.
Charles
_______________________________________________
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