• 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: Assigning an element of a swift array to a userdata parameter triggers didSet
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Assigning an element of a swift array to a userdata parameter triggers didSet (From: Eric Gorr <email@hidden>)
 >Re: Assigning an element of a swift array to a userdata parameter triggers didSet (From: Jens Alfke <email@hidden>)
 >Re: Assigning an element of a swift array to a userdata parameter triggers didSet (From: Eric Gorr <email@hidden>)

  • Prev by Date: Re: Assigning an element of a swift array to a userdata parameter triggers didSet
  • Next by Date: Re: Assigning an element of a swift array to a userdata parameter triggers didSet
  • Previous by thread: Re: Assigning an element of a swift array to a userdata parameter triggers didSet
  • Next by thread: a question concerning how to fire a message at the beginning of my application
  • Index(es):
    • Date
    • Thread