Database Reference
In-Depth Information
Similarly, every time the user taps on Rate, it executes the
rate
action in your
code. This action is currently empty. Implement it as shown below:
@IBAction
func
rate(sender:
AnyObject
) {
let
alert =
UIAlertController
(title:
"New Rating"
,
message:
"Rate this bow tie"
,
preferredStyle:
UIAlertControllerStyle
.
Alert
)
let
cancelAction =
UIAlertAction
(title:
"Cancel"
,
style: .
Default
,
handler: { (action:
UIAlertAction
!)
in
})
let
saveAction =
UIAlertAction
(title:
"Save"
,
style: .
Default
,
handler: { (action:
UIAlertAction
!)
in
let
textField = alert.
textFields
![
0
]
as
UITextField
self
.
updateRating
(textField.
text
)
alert.
addTextFieldWithConfigurationHandler
{
(textField:
UITextField
!)
in
}
alert.
addAction
(cancelAction)
alert.
addAction
(saveAction)
self
.
presentViewController
(alert,
animated:
true
,