FUIRatingControlCollectionViewCell
@MainActor
open class FUIRatingControlCollectionViewCell : FUIInlineValidationDrawingCollectionViewCell<FUIRatingControlContentView>
The reusable UI component implemented as a UICollectionViewCell, including an FUIRatingControl to allow users to select a rating.
This collection view cell uses FUIRatingControlContentView as its content view. FUIRatingControlContentView
includes an FUITextKitView for hosting the keyName property, an FUIRatingControl for the rating control,
and another FUITextKitView for the subtitle.
When the text in the subtitle is not nil, the title will not be displayed.
Control Styles
you can set the available style for FUIRatingControl to editable, editableDisabled, standard, or accented.
Example
control.style = .editable
control.ratingBounds = 0...5
control.rating = 3
control.onImage = UIImage(named: "filledStar").withRenderingMode(.alwaysTemplate)
control.onImage = UIImage(named: "openStar").withRenderingMode(.alwaysTemplate)
control.setTintColor(.orange, for: 0..<1)
control.setTintColor(.red, for: 1..<5)
control.setTintColor(.purple, for: 5..<6)
Theming
nuiClass:
fdlFUIRatingControlCollectionViewCell {}
Supported TEXT class paths:
fdlFUIRatingControlCollectionViewCell_title {}
Supported TEXT properties:
font-color: Color;
font-style: UIFontTextStyle;
Supported FUIRatingControl class path:
fdlFUIRatingControlCollectionViewCell_ratingControl
Supported RatingControl properties:
on-color { -standard | -accented | -editable-disabled | -editable-disabled }: Color;
off-color { -standard | -accented | -editable-disabled | -editable-disabled }: Color;
on-image { -standard | -editable }: Image;
off-image { -standard | -editable }: Image;
-
The key name of the property.
If
subtitleis nil, the key name will be displayed at the leading side of the table view cell, while theratingControlwill be displayed at the trailing side of the cell on the same line.Declaration
Swift
@MainActor public var keyName: String? { get set } -
The subtitle of the property.
The default
textof thesubtitleis nil.- If the
textis not nil, the key name will not be displayed. Instead, the rating control will be displayed on the top center of the cell, while the subtitle will be displayed at the bottom center of the cell. - If the
textis an empty string, both the key name and the subtitle will not be displayed. Only the rating control will be displayed at the center of the cell.
Declaration
Swift
@MainActor public var subtitle: FUIText { get } - If the
-
The
FUIRatingControlViewrepresenting the value view.Declaration
Swift
@MainActor public var ratingControl: FUIRatingControl { get } -
Indicates whether the value of the cell can be changed or not.
The default is
true. However, the value cannot be changed if thestyleproperty of theratingControlis not.editable, even ifisEditableistrue.Declaration
Swift
@MainActor public var isEditable: Bool { get set } -
The value of the property.
This is the rating value for
FUIRatingControlFormCell.Declaration
Swift
@MainActor public var value: Int { get set } -
The optional average rating value of this
FUIRatingControl, in both standard and accented styles, can display half-stars. Theratingvalue is used when the average rating value is nil in these styles.If the decimal part of the average rating value is between 0.3 and 0.7, inclusive, a half-star will be displayed. For example, 0.6 will be rounded to 0.5, 0.2 will be rounded to 0, and 0.8 will be rounded to 1.
- Setting this value below the lower bound of
ratingBoundswill be interpreted as setting it to the lower bound ofratingBounds.
Declaration
Swift
@MainActor public var averageValue: Float? { get set } - Setting this value below the lower bound of
-
Implementation of the change handler.
This is invoked on changes to the
valueproperty.Declaration
Swift
@MainActor public var onChangeHandler: ((Int) -> Void)? { get set } -
Truncates the text of the key label if appropriate.
This property indicates whether the key label text should be truncated or not when the width of the cell cannot hold the key name label and the ratings in the same line.
The default is
true, meaning that the key name will be truncated and the label and the rating will be in a single horizontal line. Otherwise, the rating will be pushed to the line below the label.Note that this property is ignored for device accessibility size larger than xxx large. In that case, the rating stars will always be in a separate line from the key label.
Declaration
Swift
@MainActor public var truncatesKeyLabel: Bool { get set } -
Wraps the text of the key label if appropriate.
This property indicates whether the key label text should be wrapped when the cell width cannot hold both the key name label and the ratings on the same line. the cell cannot hold the key name label and the ratings in the same line.
The default value is false, so the key name will not be wrapped, and the label and rating will be positioned according to the
truncatesKeyLabelproperty. If thewrapsKeyLabelproperty is set to true, the label will be allowed to wrap, and the label and rating control will be on a single line. In this case, thetruncatesKeyLabelproperty will be ignored.Declaration
Swift
@MainActor public var wrapsKeyLabel: Bool { get set } -
Undocumented
Declaration
Swift
@MainActor override public var keyCommands: [UIKeyCommand]? { get }