diff --git a/swift/Sources/GildedRose/ItemQualityUpdater.swift b/swift/Sources/GildedRose/ItemQualityUpdater.swift index 305ac4b6..3712e775 100644 --- a/swift/Sources/GildedRose/ItemQualityUpdater.swift +++ b/swift/Sources/GildedRose/ItemQualityUpdater.swift @@ -8,6 +8,9 @@ import Foundation protocol ItemQualityUpdater: CustomisedItem { + func reduceItemQuality(by value:Int) + func increaseItemQuality(by value:Int) + func setItemQuality(to value: Int) } extension ItemQualityUpdater { diff --git a/swift/Sources/GildedRose/Items/AgedBrieItem.swift b/swift/Sources/GildedRose/Items/AgedBrieItem.swift index d8a4ba8c..c7127bfd 100644 --- a/swift/Sources/GildedRose/Items/AgedBrieItem.swift +++ b/swift/Sources/GildedRose/Items/AgedBrieItem.swift @@ -7,7 +7,7 @@ import Foundation -struct AgedBrieItem: ItemStateUpdater{ +struct AgedBrieItem: CustomisedItem, ItemStateUpdater{ var item: Item private var isItemUnderHighestQuality: Bool { @@ -20,7 +20,7 @@ struct AgedBrieItem: ItemStateUpdater{ func updateItemState() { // update the sell in days. Reduce the Sell In days by 1 - reduceSellInDays(by: 1) + self.reduceSellInDays(by: 1) // Increment the Item quality by 1 if the quality is less than 50 guard isItemUnderHighestQuality else { return } diff --git a/swift/Sources/GildedRose/Items/BackstagePassesItem.swift b/swift/Sources/GildedRose/Items/BackstagePassesItem.swift index c33ce1f0..2fd0b752 100644 --- a/swift/Sources/GildedRose/Items/BackstagePassesItem.swift +++ b/swift/Sources/GildedRose/Items/BackstagePassesItem.swift @@ -7,7 +7,7 @@ import Foundation -struct BackstagePassesItem: ItemStateUpdater { +struct BackstagePassesItem: CustomisedItem, ItemStateUpdater { var item: Item private var isItemUnderHighestQuality: Bool { diff --git a/swift/Sources/GildedRose/Items/StandardItem.swift b/swift/Sources/GildedRose/Items/StandardItem.swift index dea032f7..93ecb58f 100644 --- a/swift/Sources/GildedRose/Items/StandardItem.swift +++ b/swift/Sources/GildedRose/Items/StandardItem.swift @@ -7,7 +7,7 @@ import Foundation -struct StandardItem: ItemStateUpdater { +struct StandardItem: CustomisedItem, ItemStateUpdater { var item: Item private var isSellInDatePassed: Bool{