Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extension FollowUpController {
- func numberOfSections(in collectionView: UICollectionView) -> Int {
- return self.followupArray.count
- }
- func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
- return self.followupArray[section].products.count
- }
- func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
- let cell = self.followUpView.collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! FollowUpCell
- let product = followupArray[indexPath.section].products[indexPath.row]
- let logSaleClosure = { () -> Void in
- let alertMessage = UIAlertController(title: "Good Work", message: "You just sold 1 \(product)", preferredStyle: .alert)
- alertMessage.addAction(UIAlertAction(title: "Confirm sold item", style: .default, handler: nil))
- self.present(alertMessage, animated: true, completion: nil)
- }
- cell.logButton.addTarget(self, action: #selector(FollowUpCell.didPressLogButton), for: .touchUpInside)
- cell.phoneNameLabel.text = product.name
- cell.accruedPointsLabel.text = "\(product.value) points"
- cell.pointWorthLabel.text = "\(product.sales) points"
- cell.colorLine.backgroundColor = UIColor(string: product.hexColor!)
- cell.logButton.titleLabel?.textColor = UIColor(string: product.hexColor!)
- cell.logButton.layer.borderColor = UIColor(string: product.hexColor!).cgColor
- cell.logButton.setTitle("+", for: .normal)
- return cell
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement