Multiple MVC and background work

At first I though that once you move to another MVC, the first one was kind of destroyed :-)

But I now I think they stay in memory, ready to be called again.


i have two questions to help me understand more about this, and how app work in iOS


1.

If a have a navigation controller and to reach a certain MVC I have to go through multiple MCV,

Does only the top MVC can do work or other below still can be called to work ? for example, in a MCV that has a model (without UI)



2.

i just want to know conceptually not for my exact case and not exactly about bluetooth but just a theoretical question about how a pile of MVC is used by the system.


My app has Background modes turns on, with "Use Bluetooth LE accessories"

So far it work, even if the app is not the front most app, I received data from bluetooth and log it to file, But in the few MVC that are in the pile, what if 2 of those MVC, each have an object (my bluetooth Manager) that are called when bluetooth data is received, will both be called ?




thank you

Accepted Answer

>so now i know they might so i will create just one on this manager pass it around and adjust the delagate when i segue to another mcv.


I am 'old school' and never joined the Swift or Storyboard 'club'. I therefore don't know what you are doing when you "segue". Sorry.


But I surmise that 'segue' is a term for going from one View (the V in MVC) to another View by replacing the viewController (the C in MVC) with another viewController and having that viewController load its View. If so, your question relates to the functioning of the Model (the M in MVC) and that shouldn't be affected by segue. And your solution, quoted above, seems like it will do exactly that!

I had my first programing course in 1979 :-) on terminal paper, then 2 years later, I upgraded to Punch Card :-)

so i know old shcool :-)


most of my programming did not involve complex UI, just input out output.


But now that I was force to retire, I started to have fun with iOS and the framework is impressive, Storyboard and constrain can do wonder with very little coding and will work with many screen size and orientation.


I try to take a look every year at stanford CS193P with Paul Hegarty who used to work at NeXT for Steve Jobs. He is a great teacher. He change subject a little every year so i look at the last 3 years to find the info i need. It used to avalaible in iTunes U, now in podcast and youtube.


The one for ios 12 should start at the begining of April, so maybe 2 week laters it will be available.


Thank you for your time, answer and comprehension.

You are very welcome. I fondly remember walking around with a box of punchcards in 1966 but by 1979 I had graduated to Apple 2 floppy disks. Writing iPhone apps is a fun way to spend retirement.

1966 !!! You were lucky to see them so early. The mine my father was working for tries to use a computer in mid 70 to help the process of extracting copper but it did not work As my myself I had to wait for 1982 to get an apple IIe (a copy I must say :-) with a 4 track tape to save before I could buy my floppy drive. Later a bought a real apple II They both still work and I hope one day to transfert my disk to my Mac. Sometime I do miss the simplicity of programming at that time :-)

You might be interested to know that I wrote a network program in 1982 that connected 8 Apple II computers to one Apple II computer (the one with the disk drive) using those ports in the back that connected to that tape recorder. Instead of computer-output-to-microphone-input and computer-input-to-speaker-output I went daisy-chain-8-out-to-one-in and daisy-chain-8-in-to-one-out. A bit of 6502 code and modifying Woz's Read-Write-Track-Sector code and they all accessed the one disk drive. It was almost as cool as the app Lap Swim.


Enjoy retirement. Thanks for the suggestion of going back to school for CS193P.

Wow, you are miles ahead of me.

back then i would have love to see the code. Right now it would be to difficult to understand it.

i guess it was all done in assembler ou even directly in machine langage


i used to have the rom book and i studying some part, like how a CLS worked

i never was a good programmer but i love it anyway.

in basic, on my apple ii, i did an itunes like program database (without the sound) and i was driving the head of the drive so it would constantly turn and read only when i needed, it was suppose to be faster (and did not like the noise of the moving head. i was using 8 bit to store 8 boolean to save space. i also modify the DOS to have some accentuated character to print.


with my new decifient brain, programming is great because i can have little victory. when you do something and it work, you have a reward.


being in programming at the begining, you must have ton of story to tell. i would love to read those story.

Multiple MVC and background work
 
 
Q