func presentColorPropertyAlert()

in sampleapp-tvos-swift/AnalyticsViewController.swift [42:70]


    func presentColorPropertyAlert() {
        let alert = UIAlertController(title: "Choose a color",
                                      message: "",
                                      preferredStyle: .alert)
        alert.view.tintColor = UIColor.white

        // Yellow button
        alert.addAction(UIAlertAction(title: "💛 Yellow",
                                      style: .default,
                                      handler: { _ in alert.dismiss(animated: true, completion: nil)
                                        Analytics.trackEvent("Color event", withProperties: ["Color": "Yellow"])
        }))

        // Blue button
        alert.addAction(UIAlertAction(title: "💙 Blue",
                                      style: .default,
                                      handler: { _ in alert.dismiss(animated: true, completion: nil)
                                        Analytics.trackEvent("Color event", withProperties: ["Color": "Blue"])
        }))

        // Red button
        alert.addAction(UIAlertAction(title: "❤️ Red",
                                      style: .default,
                                      handler: { _ in alert.dismiss(animated: true, completion: nil)
                                        Analytics.trackEvent("Color event", withProperties: ["Color": "Red"])
        }))

        present(alert, animated: true, completion: nil)
    }