From a parent VC two other VCs get pushed (first adds a group, second adds some (optional) more data); after popping them the parent VC appears but the new data (new group) is not added. I am using UIRefreshControl
to pull to refresh calling loadGroups(toRefresh: true)
with a Bool
value indicating if refreshing data is needed.
I would like to call same method automatically when closing the pushed VCs, so after parent VC reappears it presents new data w/o the need for pulling to refresh. I tried doing so in viewWillAppear
but then the method gets called twice- first when the parent VC first appears and then after popping the overlaying controllers. Is there a method to make sure it gets called only once (when-reappearing)?
Asked
Active
Viewed 81 times
0

agazaur
- 27
- 6
-
1A *swifty* way is a callback closure. – vadian Apr 20 '21 at 17:14
-
thanks, where would the closure be called? – agazaur Apr 20 '21 at 17:30
-
1In the child view controller. – vadian Apr 20 '21 at 17:31
-
Another way is to setup NSNotifcaition and send between controllers – iphonic Apr 20 '21 at 20:06
-
1@iphonic Don't use `Notification` if the controllers are related to each other. – vadian Apr 20 '21 at 20:53
-
Delegate or Closure if "they know each others" (usually, one "owns“ the other, or are on the "same level"). Notification if they are far away from each other. In your case, it's a parent => Closure/Delegate. – Larme Apr 21 '21 at 09:12