From 282d25cbc43a5d6fde0ea0d1b9fea1f7a4e3a728 Mon Sep 17 00:00:00 2001 From: Kushal Ashok Date: Wed, 20 Jun 2018 17:27:27 +0800 Subject: [PATCH 1/2] Adding missing outlet link --- GoLive/Base.lproj/Main.storyboard | 1 + 1 file changed, 1 insertion(+) diff --git a/GoLive/Base.lproj/Main.storyboard b/GoLive/Base.lproj/Main.storyboard index 4693a5b..af3ba8b 100644 --- a/GoLive/Base.lproj/Main.storyboard +++ b/GoLive/Base.lproj/Main.storyboard @@ -104,6 +104,7 @@ + From 86942df22dddd6f38318f5e988461320e23273c8 Mon Sep 17 00:00:00 2001 From: Kushal Ashok Date: Wed, 20 Jun 2018 17:52:15 +0800 Subject: [PATCH 2/2] Using main queue to update UI elements --- GoLive/ViewController.swift | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/GoLive/ViewController.swift b/GoLive/ViewController.swift index cce81be..381166a 100644 --- a/GoLive/ViewController.swift +++ b/GoLive/ViewController.swift @@ -93,20 +93,24 @@ class ViewController: UIViewController, RPBroadcastActivityViewControllerDelegat func broadcastStarted() { // Called to update the UI when a broadcast starts. - broadcastButton.setTitle("Stop Broadcast", for: .normal) - statusLabel.text = "You are live!" // Any app that does not notify the user that they are live will be rejected in app review. - statusLabel.textColor = UIColor.red - micSwitch.isHidden = false - micLabel.isHidden = false + DispatchQueue.main.sync { + broadcastButton.setTitle("Stop Broadcast", for: .normal) + statusLabel.text = "You are live!" // Any app that does not notify the user that they are live will be rejected in app review. + statusLabel.textColor = UIColor.red + micSwitch.isHidden = false + micLabel.isHidden = false + } } func broadcastEnded() { // Called to update the UI when a broadcast ends. - broadcastButton.setTitle("Start Broadcast", for: .normal) - statusLabel.text = "You are not live" - statusLabel.textColor = UIColor.black - micSwitch.isHidden = true - micLabel.isHidden = true + DispatchQueue.main.sync { + broadcastButton.setTitle("Start Broadcast", for: .normal) + statusLabel.text = "You are not live" + statusLabel.textColor = UIColor.black + micSwitch.isHidden = true + micLabel.isHidden = true + } }