I am creating an ios app.
I wanted to create a screen to evaluate by the number of stars, and decided to use a library called "cosmos".
I am referring to the following site.
Swift-based rating control
You can actually display stars on the screen and increase or decrease the number of stars.
And as the next step, I would like to take the number of stars as a numerical value and print it.
It does n’t work.
According to the site, the following code seems to be able to take the star value
I don't know where to write this.
cosmosView.didTouchCosmos = {rating in
// Rate value (Double) can be received with rating
}
I've never developed an app or touched swift, and I think it's caused by my lack of knowledge.
Can you tell me what is wrong? . .
Thank you.
↓ view settings screen
] (263de260fb2d1176a365a8db090ae1b0.png)
↓ viewController settings screen
↓ CosmosViewController.swift screen connected to viewController
It will be the file in error
import UIKit
import Cosmos
class cosmosViewController: UIViewController {
@IBOutlet weak var cosmosView: CosmosView!
override func viewDidLoad () {
super.viewDidLoad ()
}
cosmosView.didTouchCosmos = {rating in
// Rate value (Double) can be received with rating
print (rate)
}
}
I researched another site,
import Cosmos
@IBOutlet weak var cosmosView: CosmosView!
I described these two because they seemed necessary.
However, the error did not disappear, so I asked a question.
- xcode - i get an error when i try to install and build an external library
- xcode - tableview cannot be displayed
- xcode - i do not understand the conversion from date type to string type of swift
- ios - swiftui/i want to change the colors of multiple objects at once
- about xcode reinstall
- xcode - [swift] creating tableview
- ios - duplicate save is executed in coredata
- xcode - [swift] uiview in container view cannot be reloaded
- ios - lowercased() gives a warning
- about xcode thread 4: signal sigabrt error
Please correct as follows.