I have a UItextview where I can write inside and with a Data Class I can give the data anywhere in my Views, In the ViewDidAppear function I pass my data but It is a little bit slow. The text appear after 0.2-0.3 second, How I can solve that problem?!
-
write your code in did load section – Rahul Jan 22 '15 at 16:33
-
thats what view did appear does! http://stackoverflow.com/questions/5630649/what-is-the-difference-between-viewwillappear-and-viewdidappear – Avis Jan 22 '15 at 16:38
2 Answers
Do it in viewDidLoad:
method.
See UIViewController lifecycle :

- 3,412
- 26
- 35
-
I do not think this will account for the 0.2-0.3 second delay. By the way, that diagram is outdated, as `viewDidUnload` isn't called any more. – Rob Jan 22 '15 at 17:34
Doing some diagnostics offline, we concluded that the delay in question was really just the standard delay as you switch from one tab to another, and was nothing exceptional. This delay was exacerbated because we were observing the UX via the simulator rather than a real device. So, a couple of conclusions:
Alway perform benchmarking using actual device rather than simulator.
Rather than reacting to perceived delays, always quantify the effect, for example:
let start = CFAbsoluteTimeGetCurrent() // do some stuff let elapsed = CFAbsoluteTimeGetCurrent() - start println(String(format: "%@ took %.2f seconds", __FUNCTION__, elapsed))
Sometimes, using the Time Profiler tool in Instruments (using the "Record Waiting Threads" option) can be useful in tracking down these issues. For practical demonstration of this, see WWDC 2012 video Building Concurrent User Interfaces on iOS.

- 415,655
- 72
- 787
- 1,044