Reply To: [Resolved] sharedInstance SetActive: usage question

Home Forums OpenEars [Resolved] sharedInstance SetActive: usage question Reply To: [Resolved] sharedInstance SetActive: usage question

Halle Winkler

To clarify a bit now that I’ve seen some code which does this, I think the question is probably usually being asked in order to put the setActive: code into a lazy accessor to avoid getting rid of the OEPocketsphinxController lazy accessor pattern from 1.x.

I would recommend both against having a lazy accessor and from putting setActive: into it, since I’m not offering an API contract that I will never put anything in setActive: that would be preferable to do fewer times, although currently I don’t see a potential issue from calling setActive: multiple times.

Therefore, the best way to go would be to get rid of the lazy accessor, now or soonish, and then you will have less and simpler code, and you will also know pretty well where your first invocation of OEPocketsphinxController is so you can call setActive: one time, before it. Hope this is helpful.