Return values for NSViewController

Hi, I have two NSViewController, VC1 and VC2. VC1 activates VC2 using segue and sends a struc object that will be used in VC2 to execute a process, fills in other data in the received object that should be visible in VC1. To terminate VC2 do vc2.dimiss. How do I know that focus has returned to VC1? Which method is executed on VC1 on return? Thanks.

Accepted Reply

Which method is executed on VC1 on return?

Not sure to fully understand.

When you dismiss VC2, you should automatically get focus of VC1. But no code is executed.

You could however post notification from VC2 when dismissing and have VC1 subscribe to it.

See some details in this old thread: https://developer.apple.com/forums/thread/71955

Replies

Which method is executed on VC1 on return?

Not sure to fully understand.

When you dismiss VC2, you should automatically get focus of VC1. But no code is executed.

You could however post notification from VC2 when dismissing and have VC1 subscribe to it.

See some details in this old thread: https://developer.apple.com/forums/thread/71955

Tanks Claude31,

The answer for my problem I find here: https://developer.apple.com/forums/thread/112517?answerId=345249022#345249022.

  • Thanks for the feedback. So your question was more about calling a func from VC2 in VC1. Effectively, in this case, delegation is a very good pattern. I had forgotten this old thread… Another one may be notification.

Add a Comment