Is it possible to reload/update a viewController's view once a file gets saved in the documents folder? If yes, kindly suggest how to accomplish this.
I'm trying to save a file in AppDelegate, but as it involves XML parsing, it is saved only when a view gets loaded. This is the view that is supposed to show the contents of the file. But as it gets loaded before the file is saved, the view doesn't display anything.
This query is related to my question at this link
Shall I share the code here again?
I can guide you through the process. What you need to implement is:
NotificationthroughNotificationCenter. (Additionally you can check for the existence of the file immediately before posting theNotification).observerfor listening to thatNotificationthroughNotificationCenterin yourViewController(maybe insideviewDidLoad()).observeryou need to specify aselector(method) which will be called when the notification occurs. So add a method and provide it as theselectorfor addObserver.viewdirty. It is usually done withself.view.setNeedsDisplay(). This will do the reloading/updating part.Here I'm posting relevant code. Focus on the comments inside the code.
AppDelegate.swift
ViewController.swift
CustomXMLParser.swift