Skip to content

Commit 0bbfeaa

Browse files
committed
Clean up TMBarItem initializers
1 parent 3a597b1 commit 0bbfeaa

File tree

1 file changed

+9
-26
lines changed

1 file changed

+9
-26
lines changed

Sources/Tabman/Bar/BarItem/TMBarItem.swift

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ public protocol TMBarItemable: AnyObject {
2323
var title: String? { get set }
2424
/// Image to display.
2525
///
26-
/// - Note: If you want the image to be colored by tint colors when within a `TMBar`,
27-
/// you must use the `.alwaysTemplate` image rendering mode.
26+
/// - Note: If you want the image to be colored by tint colors when within a `TMBar`, you must use the `.alwaysTemplate` image rendering mode.
27+
/// - Warning: The usage of this property is dependent on the type of `TMBarButton` within the bar.
2828
var image: UIImage? { get set }
2929

3030
/// Image for the selected state.
31+
///
32+
/// - Warning: The usage of this property is dependent on the type of `TMBarButton` within the bar.
3133
var selectedImage: UIImage? { get set }
3234

3335
/// Badge value to display.
@@ -133,39 +135,20 @@ open class TMBarItem: TMBarItemable {
133135
///
134136
/// - Parameters:
135137
/// - image: Image of the item.
138+
/// - selectedImage: Image of the item when selected.
136139
/// - badgeValue: Badge value to display.
137-
public convenience init(image: UIImage, badgeValue: String? = nil) {
138-
self.init(with: nil, image: image, selectedImage: nil, badgeValue: badgeValue)
139-
}
140-
141-
/// Create an Item with an image.
142-
///
143-
/// - Parameters:
144-
/// - image: Image of the item.
145-
/// - selectedImage: Image of the item for selected state.
146-
/// - badgeValue: Badge value to display.
147-
public convenience init(image: UIImage, selectedImage: UIImage, badgeValue: String? = nil) {
148-
self.init(with: nil, image: image, selectedImage: nil, badgeValue: badgeValue)
149-
}
150-
151-
/// Create an Item with a title and an image.
152-
///
153-
/// - Parameters:
154-
/// - title: Title of the item.
155-
/// - image: Image of the item.
156-
/// - badgeValue: Badge value to display.
157-
public convenience init(title: String, image: UIImage, badgeValue: String? = nil) {
158-
self.init(with: title, image: image, selectedImage: nil, badgeValue: badgeValue)
140+
public convenience init(image: UIImage, selectedImage: UIImage? = nil, badgeValue: String? = nil) {
141+
self.init(with: nil, image: image, selectedImage: selectedImage, badgeValue: badgeValue)
159142
}
160143

161144
/// Create an Item with a title and an image.
162145
///
163146
/// - Parameters:
164147
/// - title: Title of the item.
165148
/// - image: Image of the item.
166-
/// - selectedImage: Image of the item for selected state.
149+
/// - selectedImage: Image of the item when selected.
167150
/// - badgeValue: Badge value to display.
168-
public convenience init(title: String, image: UIImage, selectedImage: UIImage, badgeValue: String? = nil) {
151+
public convenience init(title: String, image: UIImage, selectedImage: UIImage? = nil, badgeValue: String? = nil) {
169152
self.init(with: title, image: image, selectedImage: selectedImage, badgeValue: badgeValue)
170153
}
171154

0 commit comments

Comments
 (0)