Skip to content

Instantly share code, notes, and snippets.

@digitallysavvy
Created December 3, 2019 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save digitallysavvy/dd68724f3c8abd690371289cf1d0cb94 to your computer and use it in GitHub Desktop.
Save digitallysavvy/dd68724f3c8abd690371289cf1d0cb94 to your computer and use it in GitHub Desktop.
Snippet for setColor within the ARSupportAudienceViewController
@IBAction func setColor(_ sender: UIButton) {
guard let colorSelectionBtn = self.colorSelectionBtn else { return }
colorSelectionBtn.tintColor = sender.backgroundColor
self.lineColor = colorSelectionBtn.tintColor
toggleColorSelection()
// send data message with color components
if self.streamIsEnabled == 0 {
guard let colorComponents = sender.backgroundColor?.cgColor.components else { return }
self.agoraKit.sendStreamMessage(self.dataStreamId, data: "color: \(colorComponents)".data(using: String.Encoding.ascii)!)
if debug {
print("color: \(colorComponents)")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment