Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 66 additions & 18 deletions Shopping List.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,28 @@
objects = {

/* Begin PBXBuildFile section */
389B958C247833D900C97B5D /* ShoppingListCollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 389B958B247833D900C97B5D /* ShoppingListCollectionViewController.swift */; };
389B958E2478356E00C97B5D /* PlaceOrderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 389B958D2478356E00C97B5D /* PlaceOrderViewController.swift */; };
389B95902478362E00C97B5D /* ShoppingItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 389B958F2478362E00C97B5D /* ShoppingItem.swift */; };
389B95922478374100C97B5D /* ShoppingItemsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 389B95912478374100C97B5D /* ShoppingItemsController.swift */; };
389B959624783D2900C97B5D /* ShoppingListCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 389B959524783D2900C97B5D /* ShoppingListCollectionViewCell.swift */; };
4613E91221143BFC00E7FF73 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4613E91121143BFC00E7FF73 /* AppDelegate.swift */; };
4613E91421143BFC00E7FF73 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4613E91321143BFC00E7FF73 /* ViewController.swift */; };
4613E91721143BFC00E7FF73 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4613E91521143BFC00E7FF73 /* Main.storyboard */; };
4613E91721143BFC00E7FF73 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4613E91521143BFC00E7FF73 /* LaunchScreen.storyboard */; };
4613E91921143BFD00E7FF73 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4613E91821143BFD00E7FF73 /* Assets.xcassets */; };
4613E91C21143BFD00E7FF73 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4613E91A21143BFD00E7FF73 /* LaunchScreen.storyboard */; };
4613E91C21143BFD00E7FF73 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4613E91A21143BFD00E7FF73 /* Main.storyboard */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
389B958B247833D900C97B5D /* ShoppingListCollectionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingListCollectionViewController.swift; sourceTree = "<group>"; };
389B958D2478356E00C97B5D /* PlaceOrderViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaceOrderViewController.swift; sourceTree = "<group>"; };
389B958F2478362E00C97B5D /* ShoppingItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingItem.swift; sourceTree = "<group>"; };
389B95912478374100C97B5D /* ShoppingItemsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingItemsController.swift; sourceTree = "<group>"; };
389B959524783D2900C97B5D /* ShoppingListCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingListCollectionViewCell.swift; sourceTree = "<group>"; };
4613E90E21143BFC00E7FF73 /* Shopping List.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Shopping List.app"; sourceTree = BUILT_PRODUCTS_DIR; };
4613E91121143BFC00E7FF73 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
4613E91321143BFC00E7FF73 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
4613E91621143BFC00E7FF73 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
4613E91621143BFC00E7FF73 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
4613E91821143BFD00E7FF73 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
4613E91B21143BFD00E7FF73 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
4613E91B21143BFD00E7FF73 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
4613E91D21143BFD00E7FF73 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand All @@ -35,6 +43,43 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
389B9587247822FD00C97B5D /* Resources */ = {
isa = PBXGroup;
children = (
4613E91121143BFC00E7FF73 /* AppDelegate.swift */,
4613E91821143BFD00E7FF73 /* Assets.xcassets */,
);
path = Resources;
sourceTree = "<group>";
};
389B95882478231A00C97B5D /* View */ = {
isa = PBXGroup;
children = (
4613E91521143BFC00E7FF73 /* LaunchScreen.storyboard */,
4613E91A21143BFD00E7FF73 /* Main.storyboard */,
);
path = View;
sourceTree = "<group>";
};
389B95892478232A00C97B5D /* Controller */ = {
isa = PBXGroup;
children = (
389B958B247833D900C97B5D /* ShoppingListCollectionViewController.swift */,
389B958D2478356E00C97B5D /* PlaceOrderViewController.swift */,
);
path = Controller;
sourceTree = "<group>";
};
389B958A2478233500C97B5D /* Model */ = {
isa = PBXGroup;
children = (
389B959524783D2900C97B5D /* ShoppingListCollectionViewCell.swift */,
389B958F2478362E00C97B5D /* ShoppingItem.swift */,
389B95912478374100C97B5D /* ShoppingItemsController.swift */,
);
path = Model;
sourceTree = "<group>";
};
4613E90521143BFC00E7FF73 = {
isa = PBXGroup;
children = (
Expand All @@ -54,11 +99,10 @@
4613E91021143BFC00E7FF73 /* Shopping List */ = {
isa = PBXGroup;
children = (
4613E91121143BFC00E7FF73 /* AppDelegate.swift */,
4613E91321143BFC00E7FF73 /* ViewController.swift */,
4613E91521143BFC00E7FF73 /* Main.storyboard */,
4613E91821143BFD00E7FF73 /* Assets.xcassets */,
4613E91A21143BFD00E7FF73 /* LaunchScreen.storyboard */,
389B958A2478233500C97B5D /* Model */,
389B95892478232A00C97B5D /* Controller */,
389B95882478231A00C97B5D /* View */,
389B9587247822FD00C97B5D /* Resources */,
4613E91D21143BFD00E7FF73 /* Info.plist */,
);
path = "Shopping List";
Expand Down Expand Up @@ -122,9 +166,9 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4613E91C21143BFD00E7FF73 /* LaunchScreen.storyboard in Resources */,
4613E91C21143BFD00E7FF73 /* Main.storyboard in Resources */,
4613E91921143BFD00E7FF73 /* Assets.xcassets in Resources */,
4613E91721143BFC00E7FF73 /* Main.storyboard in Resources */,
4613E91721143BFC00E7FF73 /* LaunchScreen.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -135,28 +179,32 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4613E91421143BFC00E7FF73 /* ViewController.swift in Sources */,
389B95902478362E00C97B5D /* ShoppingItem.swift in Sources */,
389B958C247833D900C97B5D /* ShoppingListCollectionViewController.swift in Sources */,
4613E91221143BFC00E7FF73 /* AppDelegate.swift in Sources */,
389B95922478374100C97B5D /* ShoppingItemsController.swift in Sources */,
389B959624783D2900C97B5D /* ShoppingListCollectionViewCell.swift in Sources */,
389B958E2478356E00C97B5D /* PlaceOrderViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXVariantGroup section */
4613E91521143BFC00E7FF73 /* Main.storyboard */ = {
4613E91521143BFC00E7FF73 /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
4613E91621143BFC00E7FF73 /* Base */,
);
name = Main.storyboard;
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
4613E91A21143BFD00E7FF73 /* LaunchScreen.storyboard */ = {
4613E91A21143BFD00E7FF73 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
4613E91B21143BFD00E7FF73 /* Base */,
);
name = LaunchScreen.storyboard;
name = Main.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
Expand Down
25 changes: 0 additions & 25 deletions Shopping List/Base.lproj/LaunchScreen.storyboard

This file was deleted.

31 changes: 31 additions & 0 deletions Shopping List/Controller/PlaceOrderViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// PlaceOrderViewController.swift
// Shopping List
//
// Created by Jason Hoover on 5/22/20.
// Copyright © 2020 Lambda School. All rights reserved.
//

import UIKit

class PlaceOrderViewController: UIViewController {


override func viewDidLoad() {
super.viewDidLoad()

// Do any additional setup after loading the view.
}


/*
// MARK: - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
//
// ShoppingListCollectionViewController.swift
// Shopping List
//
// Created by Jason Hoover on 5/22/20.
// Copyright © 2020 Lambda School. All rights reserved.
//

import UIKit

class ShoppingListCollectionViewController: UICollectionViewController {

let shoppingItemsController = ShoppingItemController()

override func viewDidLoad() {
super.viewDidLoad()

}


// MARK: - Navigation

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "toOrderScreen" {
guard let placeOrderVC = segue.destination as? PlaceOrderViewController else {
return
}



}
}


// MARK: UICollectionViewDataSource

override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of items
return shoppingItemsController.itemsAvailable.count
}

override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ShoppingItems", for: indexPath) as? ShoppingListCollectionViewCell else { fatalError("Collection view cell identifier is wrong or the cell is not a ShoppingListCollectionViewCell")}


return cell
}

// MARK: UICollectionViewDelegate

/*
// Uncomment this method to specify if the specified item should be highlighted during tracking
override func collectionView(_ collectionView: UICollectionView, shouldHighlightItemAt indexPath: IndexPath) -> Bool {
return true
}
*/

/*
// Uncomment this method to specify if the specified item should be selected
override func collectionView(_ collectionView: UICollectionView, shouldSelectItemAt indexPath: IndexPath) -> Bool {
return true
}
*/

/*
// Uncomment these methods to specify if an action menu should be displayed for the specified item, and react to actions performed on the item
override func collectionView(_ collectionView: UICollectionView, shouldShowMenuForItemAt indexPath: IndexPath) -> Bool {
return false
}

override func collectionView(_ collectionView: UICollectionView, canPerformAction action: Selector, forItemAt indexPath: IndexPath, withSender sender: Any?) -> Bool {
return false
}

override func collectionView(_ collectionView: UICollectionView, performAction action: Selector, forItemAt indexPath: IndexPath, withSender sender: Any?) {

}
*/

}
22 changes: 22 additions & 0 deletions Shopping List/Model/ShoppingItem.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// ShoppingItem.swift
// Shopping List
//
// Created by Jason Hoover on 5/22/20.
// Copyright © 2020 Lambda School. All rights reserved.
//

import UIKit

struct ShoppingItem {

var name: String
var image: UIImage
var inCart: Bool

init(name: String, imageName: String) {
self.name = name
self.image = UIImage(named: imageName)!
self.inCart = false
}
}
27 changes: 27 additions & 0 deletions Shopping List/Model/ShoppingItemsController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// ShoppingItemsController.swift
// Shopping List
//
// Created by Jason Hoover on 5/22/20.
// Copyright © 2020 Lambda School. All rights reserved.
//

import Foundation

class ShoppingItemController {

var itemsAvailable: [ShoppingItem] {

let items = [
ShoppingItem(name: "Apple", imageName: "Apple"),
ShoppingItem(name: "Grapes", imageName: "Grapes"),
ShoppingItem(name: "Milk", imageName: "Milk"),
ShoppingItem(name: "Muffins", imageName: "Muffins"),
ShoppingItem(name: "Popcorn", imageName: "Popcorn"),
ShoppingItem(name: "Soda", imageName: "Soda"),
ShoppingItem(name: "Strawberry", imageName: "Strawberry")
]

return items
}
}
17 changes: 17 additions & 0 deletions Shopping List/Model/ShoppingListCollectionViewCell.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// ShoppingListCollectionViewCell.swift
// Shopping List
//
// Created by Jason Hoover on 5/22/20.
// Copyright © 2020 Lambda School. All rights reserved.
//

import UIKit

class ShoppingListCollectionViewCell: UICollectionViewCell {

@IBOutlet weak var addedTOCartLabel: UILabel!
@IBOutlet weak var imageView: UIImageView!
@IBOutlet weak var nameLabel: UILabel!

}
Loading