Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS communication ViewController -> Model
    primarykey
    data
    text
    <p>This is really a starter question but I somehow can't figure out a good way to solve this.</p> <p><strong>The problem:</strong> I want my ViewController to tell my "model" what sounds to play and when they should be changed and played.</p> <p><strong>What I have:</strong> A AudioPlayer class which I created and is just a subclass of NSObject. It sets up my audioSession and handless my apps sound progression. Now I basically just want my ViewControllers to be able to send an integer over to my AudioPlayer class and have that class perform a function that would swap in a new sound path for the player. The player is a object belonging to the AudiPlayer class and can't be called from a global/shared function.</p> <p><strong>What I've tried:</strong> Having global variables and setting them from the ViewControllers which doesn't solve my problem of calling a in class function. I actually got passed this problem with a repetitive timer that called an function from inside the class to check regularly if a global Boolean had been set to TRUE and then performed a sound swap but I find this very messy.. this can't be the optimal way?</p> <p>I've been trying singletons (which my class is now).. not that it's helping me with this problem</p> <p>I've also been looking at delegates but using them I always end up messing up my audioplayer delegate(I think!), audioplayer ends up playing nothing(but seems to run fine over each command). Debugging the player setup shows though: audioplayer error: unknown class.</p> <p><strong>Any suggestions or good answers to this problem are very well appreciated.</strong> Thank you</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload