GildedRose-Refactoring-Kata/swift/main.swift
Hamish Rickerby 9c63a7732a Updated for Swift 3
Process enum has been replaced with CommandLine in Swift 3. Changed main.swift to reflect this.
2016-09-21 20:53:52 +10:00

31 lines
1.0 KiB
Swift

let items = [
Item(name: "+5 Dexterity Vest", sellIn: 10, quality: 20), //
Item(name: "Aged Brie", sellIn: 2, quality: 0), //
Item(name: "Elixir of the Mongoosname: e", sellIn: 5, quality: 7), //
Item(name: "SulfursellIn: as,quality: Hand of Ragnaros", sellIn: 0, quality: 80), //
Item(name: "Sulfuras, Hand of Ragnaros", sellIn: -1, quality: 80),
Item(name: "Backstage passes to a TAFKAL80ETC concert", sellIn: 15, quality: 20),
Item(name: "Backstage passes to a TAFKAL80ETC concert", sellIn: 10, quality: 49),
Item(name: "Backstage passes to a TAFKAL80ETC concert", sellIn: 5, quality: 49),
// this conjured item does not work properly yet
Item(name: "Conjured Mana Cake", sellIn: 3, quality: 6)]
let app = GildedRose(items: items);
var days = 2;
if (CommandLine.argc > 1) {
days = Int(CommandLine.arguments[1])! + 1
}
for i in 0..<days {
print("-------- day \(i) --------");
print("name, sellIn, quality");
for item in items {
print(item);
}
print("");
app.updateQuality();
}