in sampleapp-ios-swift/AnalyticsViewController.swift [51:79]
func presentColorPropertyAlert() {
let alert = UIAlertController(title: "Choose a color",
message: "",
preferredStyle: .alert)
alert.view.tintColor = UIColor.black
// Yellow button
alert.addAction(UIAlertAction(title: "💛 Yellow",
style: .default,
handler: { _ in alert.dismiss(animated: true)
Analytics.trackEvent("Color event", withProperties: ["Color": "Yellow"])
}))
// Blue button
alert.addAction(UIAlertAction(title: "💙 Blue",
style: .default,
handler: { _ in alert.dismiss(animated: true)
Analytics.trackEvent("Color event", withProperties: ["Color": "Blue"])
}))
// Red button
alert.addAction(UIAlertAction(title: "❤️ Red",
style: .default,
handler: { _ in alert.dismiss(animated: true)
Analytics.trackEvent("Color event", withProperties: ["Color": "Red"])
}))
present(alert, animated: true)
}