> On Sep 21, 2016, at 8:40 AM, Dave <d...@looktowindward.com> wrote: > > How can I update my UI from a background thread?
You can’t literally do that. But you can schedule code to run on the main thread, and update the UI in that code. Use dispatch_async to schedule the UI-related code on the main thread/queue. Or if you’re feeling old-school, use -performSelectorOnMainThread:. Even so, it’s a better design to decouple the UI-related code from the worker code. For instance you could have the worker code post a notification that the UI code can observe. Since the notification will get delivered on the worker thread, the UI code’s observer method should use the techniques above to tell itself to do the work on the main thread. —Jens _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com