Delegates & Protocols in 'Tabbed App'

Hi all - quick question: Is there anything I need to do differently with respect to ‘protocols & delegates’ for tabbed apps?

…basically… I think I do understand (generally) protocols and delegates now (thanks to the kind help from people on this forum), but I’m struggling to implement them within a tabbed app that I’m making.
I’m just trying to implement them on a brand new ‘tabbed app’, whereby I have a toggle switch on one of the tabbed ViewControllers (set up with it’s own dedicated ViewController Class) and simply trying to get this to change the text of a UILabel on another tabbed ViewController (again, on its own dedicated ViewController Class)… for some reason it’s just not working. from the console/log I can tell that the switch is being activated, but it seems that the message isn’t being ‘heard’ by the other view controller.

I have checked over and over again the code (in reference to lessons with CodeWithChris, as well as in reference to other online sources) and I’m pretty sure I’ve got the code right… I’m just thinking: is there something intrinsically different with ‘tabbed’ apps that I should be aware of?

maybe not… but thought I’d check/ask…

P.S. I’m a bit of a novice, and never had any experience of Tabbed apps before (although I did look online and figured that I need to give each one it’s own ViewController class, and assign them within the storyboard.

(replying to my own query, to give a bit more detail)
I’ve discovered that my issue isn’t just limited to ‘tabbed’ apps… as I’m instead struggling with Delegates and Protocols generally, because I’m failing to implement them on even the simplest multi-screen app. I’ve made a 2min 30sec video of it, on a super-basic app… in case anyone is able.interested to help…?

with thanks in advance again!

Check otherScreen. You never set it to anything so it’s nil, which means it never gets its delegate set.

You should make a prepareForSegue method in your first view controller where you get the view controller you are moving to and you can set its delegate there.

@roosterboy ah! yes, now i understand better… thank you so much.
Silly amateur mistake of mine… 'keep having to remind myself that classes (like ‘otherScreen’) are just classes and not the actual objects themselves!
Many thanks for your kind help :slight_smile: