Skip to content
Permalink
Browse files

Merge pull request #10 from jhrcook/jazzy-doc

Jazzy doc
  • Loading branch information...
jhrcook committed Oct 1, 2019
2 parents 42058c4 + ac008c8 commit 5977d394048301058325cd9f10f8896e70ea00c4
Showing with 53,397 additions and 123 deletions.
  1. +8 −0 PlantTracker/.jazzy.yaml
  2. +6 −1 PlantTracker/PlantTracker/Controllers/GeneralPlantInformationTableViewController.swift
  3. +71 −10 PlantTracker/PlantTracker/Controllers/ImageCollectionViewController.swift
  4. +47 −8 PlantTracker/PlantTracker/Controllers/ImagePagingCollectionViewController.swift
  5. +64 −10 PlantTracker/PlantTracker/Controllers/LibraryDetailViewController.swift
  6. +2 −10 PlantTracker/PlantTracker/Controllers/LinksTableViewController.swift
  7. +55 −10 PlantTracker/PlantTracker/Controllers/PlantAssetsPickerViewController.swift
  8. +32 −5 PlantTracker/PlantTracker/Controllers/PlantLibraryTableViewController.swift
  9. +21 −0 PlantTracker/PlantTracker/Models/AssetIndexIDTracker.swift
  10. +11 −11 PlantTracker/PlantTracker/Models/EditPlantLevelManager.swift
  11. +53 −14 PlantTracker/PlantTracker/Models/Plant.swift
  12. +12 −2 PlantTracker/PlantTracker/Models/PlantsManager.swift
  13. +6 −3 PlantTracker/PlantTracker/Views/EditingTableViewCell.swift
  14. +3 −0 PlantTracker/PlantTracker/Views/GeneralInformtationTableViewCell.swift
  15. +1 −0 PlantTracker/PlantTracker/Views/ImageCollectionViewCell.swift
  16. +27 −4 PlantTracker/PlantTracker/Views/ImagePagingViewCell.swift
  17. +41 −7 PlantTracker/PlantTracker/Views/LibraryDetailView.swift
  18. +20 −3 PlantTracker/PlantTracker/Views/PlantLibraryTableViewCell.swift
  19. +51 −9 PlantTracker/PlantTracker/Zoom Animation/ZoomAnimator.swift
  20. +30 −2 PlantTracker/PlantTracker/Zoom Animation/ZoomDismissalInteractionController.swift
  21. +33 −7 PlantTracker/PlantTracker/Zoom Animation/ZoomTransitionController.swift
  22. +958 −0 PlantTracker/docs/Classes.html
  23. +427 −0 PlantTracker/docs/Classes/AppDelegate.html
  24. +824 −0 PlantTracker/docs/Classes/EditPlantLevelManager.html
  25. +372 −0 PlantTracker/docs/Classes/EditPlantLevelManager/PlantLevel.html
  26. +406 −0 PlantTracker/docs/Classes/EditingTableViewCell.html
  27. +323 −0 PlantTracker/docs/Classes/GeneralInformtationTableViewCell.html
  28. +837 −0 PlantTracker/docs/Classes/GeneralPlantInformationTableViewController.html
  29. +291 −0 PlantTracker/docs/Classes/GeneralPlantInformationTableViewController/PlantName.html
  30. +321 −0 PlantTracker/docs/Classes/ImageCollectionViewCell.html
  31. +1,761 −0 PlantTracker/docs/Classes/ImageCollectionViewController.html
  32. +1,263 −0 PlantTracker/docs/Classes/ImagePagingCollectionViewController.html
  33. +707 −0 PlantTracker/docs/Classes/ImagePagingViewCell.html
  34. +1,017 −0 PlantTracker/docs/Classes/LibraryDetailView.html
  35. +1,259 −0 PlantTracker/docs/Classes/LibraryDetailViewController.html
  36. +291 −0 PlantTracker/docs/Classes/LibraryDetailViewController/TextViewState.html
  37. +469 −0 PlantTracker/docs/Classes/LinksTableViewController.html
  38. +927 −0 PlantTracker/docs/Classes/Plant.html
  39. +885 −0 PlantTracker/docs/Classes/PlantAssetsPickerViewController.html
  40. +575 −0 PlantTracker/docs/Classes/PlantLibraryTableViewCell.html
  41. +787 −0 PlantTracker/docs/Classes/PlantLibraryTableViewController.html
  42. +411 −0 PlantTracker/docs/Classes/PlantsManager.html
  43. +372 −0 PlantTracker/docs/Classes/Seller.html
  44. +606 −0 PlantTracker/docs/Classes/ZoomAnimator.html
  45. +552 −0 PlantTracker/docs/Classes/ZoomDismissalInteractionController.html
  46. +609 −0 PlantTracker/docs/Classes/ZoomTransitionController.html
  47. +382 −0 PlantTracker/docs/Enums.html
  48. +318 −0 PlantTracker/docs/Enums/DifficultyLevel.html
  49. +426 −0 PlantTracker/docs/Enums/LightLevel.html
  50. +453 −0 PlantTracker/docs/Enums/PlantInformationIndex.html
  51. +345 −0 PlantTracker/docs/Enums/Season.html
  52. +345 −0 PlantTracker/docs/Enums/WateringLevel.html
  53. +258 −0 PlantTracker/docs/Extensions.html
  54. +263 −0 PlantTracker/docs/Extensions/CGRect.html
  55. +366 −0 PlantTracker/docs/Functions.html
  56. +320 −0 PlantTracker/docs/Global Variables.html
  57. +447 −0 PlantTracker/docs/Protocols.html
  58. +264 −0 PlantTracker/docs/Protocols/AssetPickerFinishedSelectingDelegate.html
  59. +318 −0 PlantTracker/docs/Protocols/EditedImageDelegate.html
  60. +291 −0 PlantTracker/docs/Protocols/ImagePagingCollectionViewControllerDelegate.html
  61. +264 −0 PlantTracker/docs/Protocols/LibraryDetailContainerDelegate.html
  62. +264 −0 PlantTracker/docs/Protocols/PagingViewWasTappedDelegate.html
  63. +264 −0 PlantTracker/docs/Protocols/ParentTableViewDelegate.html
  64. +346 −0 PlantTracker/docs/Protocols/ZoomAnimatorDelegate.html
  65. +291 −0 PlantTracker/docs/Structs.html
  66. +553 −0 PlantTracker/docs/Structs/AssetIndexIDTracker.html
  67. +507 −0 PlantTracker/docs/Structs/Log.html
  68. +28 −0 PlantTracker/docs/badge.svg
  69. +200 −0 PlantTracker/docs/css/highlight.css
  70. +343 −0 PlantTracker/docs/css/jazzy.css
  71. +20 −0 PlantTracker/docs/docsets/.docset/Contents/Info.plist
  72. +958 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Classes.html
  73. +427 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Classes/AppDelegate.html
  74. +824 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Classes/EditPlantLevelManager.html
  75. +372 −0 ...r/docs/docsets/.docset/Contents/Resources/Documents/Classes/EditPlantLevelManager/PlantLevel.html
  76. +406 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Classes/EditingTableViewCell.html
  77. +323 −0 ...r/docs/docsets/.docset/Contents/Resources/Documents/Classes/GeneralInformtationTableViewCell.html
  78. +837 −0 ...sets/.docset/Contents/Resources/Documents/Classes/GeneralPlantInformationTableViewController.html
  79. +291 −0 ...et/Contents/Resources/Documents/Classes/GeneralPlantInformationTableViewController/PlantName.html
  80. +321 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Classes/ImageCollectionViewCell.html
  81. +1,761 −0 ...cker/docs/docsets/.docset/Contents/Resources/Documents/Classes/ImageCollectionViewController.html
  82. +1,263 −0 ...ocs/docsets/.docset/Contents/Resources/Documents/Classes/ImagePagingCollectionViewController.html
  83. +707 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Classes/ImagePagingViewCell.html
  84. +1,017 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Classes/LibraryDetailView.html
  85. +1,259 −0 ...racker/docs/docsets/.docset/Contents/Resources/Documents/Classes/LibraryDetailViewController.html
  86. +291 −0 ...csets/.docset/Contents/Resources/Documents/Classes/LibraryDetailViewController/TextViewState.html
  87. +469 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Classes/LinksTableViewController.html
  88. +927 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Classes/Plant.html
  89. +885 −0 ...er/docs/docsets/.docset/Contents/Resources/Documents/Classes/PlantAssetsPickerViewController.html
  90. +575 −0 ...tTracker/docs/docsets/.docset/Contents/Resources/Documents/Classes/PlantLibraryTableViewCell.html
  91. +787 −0 ...er/docs/docsets/.docset/Contents/Resources/Documents/Classes/PlantLibraryTableViewController.html
  92. +411 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Classes/PlantsManager.html
  93. +372 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Classes/Seller.html
  94. +606 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Classes/ZoomAnimator.html
  95. +552 −0 ...docs/docsets/.docset/Contents/Resources/Documents/Classes/ZoomDismissalInteractionController.html
  96. +609 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Classes/ZoomTransitionController.html
  97. +382 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Enums.html
  98. +318 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Enums/DifficultyLevel.html
  99. +426 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Enums/LightLevel.html
  100. +453 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Enums/PlantInformationIndex.html
  101. +345 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Enums/Season.html
  102. +345 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Enums/WateringLevel.html
  103. +258 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Extensions.html
  104. +263 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Extensions/CGRect.html
  105. +366 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Functions.html
  106. +320 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Global Variables.html
  107. +447 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Protocols.html
  108. +264 −0 .../docsets/.docset/Contents/Resources/Documents/Protocols/AssetPickerFinishedSelectingDelegate.html
  109. +318 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Protocols/EditedImageDelegate.html
  110. +291 −0 ...s/.docset/Contents/Resources/Documents/Protocols/ImagePagingCollectionViewControllerDelegate.html
  111. +264 −0 ...r/docs/docsets/.docset/Contents/Resources/Documents/Protocols/LibraryDetailContainerDelegate.html
  112. +264 −0 ...cker/docs/docsets/.docset/Contents/Resources/Documents/Protocols/PagingViewWasTappedDelegate.html
  113. +264 −0 ...tTracker/docs/docsets/.docset/Contents/Resources/Documents/Protocols/ParentTableViewDelegate.html
  114. +346 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Protocols/ZoomAnimatorDelegate.html
  115. +291 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Structs.html
  116. +553 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Structs/AssetIndexIDTracker.html
  117. +507 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/Structs/Log.html
  118. +28 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/badge.svg
  119. +200 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/css/highlight.css
  120. +343 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/css/jazzy.css
  121. BIN PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/img/carat.png
  122. BIN PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/img/dash.png
  123. BIN PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/img/gh.png
  124. +265 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/index.html
  125. +59 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/js/jazzy.js
  126. +2 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/js/jquery.min.js
  127. +1 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/search.json
  128. +6 −0 PlantTracker/docs/docsets/.docset/Contents/Resources/Documents/undocumented.json
  129. BIN PlantTracker/docs/docsets/.docset/Contents/Resources/docSet.dsidx
  130. BIN PlantTracker/docs/docsets/.tgz
  131. +20 −0 PlantTracker/docs/docsets/PlantTracker.docset/Contents/Info.plist
  132. +28 −0 PlantTracker/docs/docsets/PlantTracker.docset/Contents/Resources/Documents/badge.svg
  133. +200 −0 PlantTracker/docs/docsets/PlantTracker.docset/Contents/Resources/Documents/css/highlight.css
  134. +343 −0 PlantTracker/docs/docsets/PlantTracker.docset/Contents/Resources/Documents/css/jazzy.css
  135. BIN PlantTracker/docs/docsets/PlantTracker.docset/Contents/Resources/Documents/img/carat.png
  136. BIN PlantTracker/docs/docsets/PlantTracker.docset/Contents/Resources/Documents/img/dash.png
  137. BIN PlantTracker/docs/docsets/PlantTracker.docset/Contents/Resources/Documents/img/gh.png
  138. +89 −0 PlantTracker/docs/docsets/PlantTracker.docset/Contents/Resources/Documents/index.html
  139. +59 −0 PlantTracker/docs/docsets/PlantTracker.docset/Contents/Resources/Documents/js/jazzy.js
  140. +2 −0 PlantTracker/docs/docsets/PlantTracker.docset/Contents/Resources/Documents/js/jquery.min.js
  141. +1 −0 PlantTracker/docs/docsets/PlantTracker.docset/Contents/Resources/Documents/search.json
  142. +6 −0 PlantTracker/docs/docsets/PlantTracker.docset/Contents/Resources/Documents/undocumented.json
  143. BIN PlantTracker/docs/docsets/PlantTracker.docset/Contents/Resources/docSet.dsidx
  144. BIN PlantTracker/docs/docsets/PlantTracker.tgz
  145. BIN PlantTracker/docs/img/carat.png
  146. BIN PlantTracker/docs/img/dash.png
  147. BIN PlantTracker/docs/img/gh.png
  148. +265 −0 PlantTracker/docs/index.html
  149. +59 −0 PlantTracker/docs/js/jazzy.js
  150. +2 −0 PlantTracker/docs/js/jquery.min.js
  151. +1 −0 PlantTracker/docs/search.json
  152. +1,139 −0 PlantTracker/docs/undocumented.json
  153. +24 −7 README.md
@@ -0,0 +1,8 @@
min_acl: private
output: docs/
author: Joshua Cook
author_url: https://joshuacook.netlify.com
github_url: https://github.com/jhrcook/PlantTracker
readme: ../README.md
sdk: iphone
theme: apple
@@ -14,14 +14,18 @@ import os
enum PlantInformationIndex: Int, Equatable {
case scientificName = 0, commonName, growingSeason, dormantSeason, difficultyLevel, wateringLevel, lightingLevel

/// Get the number of cases.
static let count: Int = {
var max: Int = 0
while let _ = PlantInformationIndex(rawValue: max) { max += 1 }
return max
}()
}


/**
Table view controller within the `LibraryDetailViewController` that presents the general information of a plant.
The complexity of this view controller is mainly due to the system for editing the plant's atteributes.
*/
class GeneralPlantInformationTableViewController: UITableViewController {


@@ -33,6 +37,7 @@ class GeneralPlantInformationTableViewController: UITableViewController {
var plantsManager: PlantsManager!

/// Delegate to handle the editing row for collection type information
/// - TODO: make private
var editManager: EditPlantLevelManager?

/// Prepares the view controller by setting it as the delegate for the table view
@@ -14,18 +14,35 @@ private let reuseIdentifier = "image"

class ImageCollectionViewController: UICollectionViewController {

/// An array of `UIImage` objects to display.
var images = [UIImage]()

/// A label that apppears if there are no images.
/// - TODO: use closure syntax to set it up at declaration
/// - TODO: make private and lazy
var noImagesLabel = UILabel()

/// The currently selected index.
///
/// This is mainly used for interactions with a `ImagePagingCollectionViewController`
var currentIndex = 0

/// The `Plant` object whose images are being displayed.
var plant: Plant!

/// An object that manages the array of `Plant` objects.
var plantsManager: PlantsManager!

/// The number of images in a row
/// - TODO: make private
let numberOfImagesPerRow: CGFloat = 4.0

/// The spacing between images.
/// - TODO: make private
let spacingBetweenCells: CGFloat = 0.5

/// A `boolean` indicating whether multiple cells be selected. The selected images can then be shared or deleted.
/// - TODO: make private
var inMultiSelectMode = false {
didSet {

@@ -42,7 +59,13 @@ class ImageCollectionViewController: UICollectionViewController {
}
}
}

/// Indices of selected images.
/// - TODO: make private
var selectedImageIndices = [Int]()

/// The standard title to use when *not* in multi-select mode (`inMultiSelectMode == false`). It is set to the same `String` as `self.title`
/// in `viewDidLoad()`.
var standardTitle: String?


@@ -68,7 +91,9 @@ class ImageCollectionViewController: UICollectionViewController {
setupToolbar()
}


/// Load the images of a plant into `images: [UIImage]`. It is called once during set up and when the user is done selecting new images.
/// - TODO: experiment with loading the images in `cellForRowAt:`
/// - TODO: make private
func loadImages() {
os_log("Setting up %d images.", log: Log.imageCollectionVC, type: .info, plant.images.count)
images.removeAll(keepingCapacity: true)
@@ -102,7 +127,7 @@ class ImageCollectionViewController: UICollectionViewController {
if inMultiSelectMode { inMultiSelectMode = false }
}


/// An action sheet is presented to imort or edit images.
@objc func editButtonTapped() {
let ac = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
ac.addAction(UIAlertAction(title: "Import images", style: .default, handler: addImages))
@@ -175,6 +200,8 @@ extension ImageCollectionViewController {
extension ImageCollectionViewController: AssetPickerFinishedSelectingDelegate {

/// Add images to the plant using `PlantAssetsPickerViewController`. `self` is set as the delegate.
/// - parameter alert: The alert action that called the function (not used).
@objc func addImages(_ alert: UIAlertAction) {
let imagePicker = PlantAssetsPickerViewController()
imagePicker.plant = plant
@@ -185,7 +212,9 @@ extension ImageCollectionViewController: AssetPickerFinishedSelectingDelegate {
present(imagePicker, animated: true)
}


/// This function is called when the user is done selecting images. It saves the plants,
/// loads the images into `images: [UIImage]` and reloads the data.
/// - parameter assetPicker: The `PlantAssetsPickerViewController` that called the function.
func didFinishSelecting(assetPicker: PlantAssetsPickerViewController) {
os_log("AssetPicker did finish selecting.", log: Log.detailLibraryVC, type: .info)

@@ -201,10 +230,11 @@ extension ImageCollectionViewController: AssetPickerFinishedSelectingDelegate {



// for multi-selection editing
// MARK: Multi-select mode
extension ImageCollectionViewController {

/// Organize the tool bar for multi-select mode. The tool bar will have a trash and a share icons for deleting or sharing images.
func setupToolbar() {
let trashToolbarButton = UIBarButtonItem(barButtonSystemItem: .trash, target: self, action: #selector(deleteSelectedImages))
let shareToolbarButton = UIBarButtonItem(barButtonSystemItem: .action, target: self, action: #selector(shareSelectedImages))
@@ -213,12 +243,15 @@ extension ImageCollectionViewController {
navigationController?.setToolbarHidden(true, animated: false)
}


/// Called to turn on miltu-select mode by setting `inMultiSelectMode` to `true`.
/// - parameter alert: The alert action that called the function (not used).
@objc func selectMultipleImages(_ alert: UIAlertAction) {
inMultiSelectMode = true
}


/// Delete the currently selected images. The images are deleted from `images: [UIImage]`, the `plant.images: [String]`, removed from disk
/// And from the collection view. The deletion is animated by calling `collectionView.deleteItems(at: [IndexPath])`.
/// - parameter alert: The alert action that called the function (not used).
@objc func deleteSelectedImages(_ alert: UIAlertAction) {
if selectedImageIndices.count > 0 {
let ac = UIAlertController(title: "Delete \(selectedImageIndices.count) images?", message: "Are you sure you want to delete the selected images?", preferredStyle: .alert)
@@ -241,7 +274,8 @@ extension ImageCollectionViewController {
}
}


/// Share the currently selected images using the satandard `UIActivityViewController(activityItems:applicationActivities:)`.
/// - parameter alert: The alert action that called the function (not used).
@objc func shareSelectedImages(_ alert: UIAlertAction) {
if selectedImageIndices.count > 0 {
var imagesToShare = [UIImage]()
@@ -257,7 +291,7 @@ extension ImageCollectionViewController {
}
}


/// Deactivate multi-select mode by setting `inMultiSelectMode` to `false`.
@objc func exitMultiSelectionMode(_ alert: UIAlertAction) {
inMultiSelectMode = false
collectionView.reloadData()
@@ -290,7 +324,7 @@ extension ImageCollectionViewController: UICollectionViewDelegateFlowLayout {



// MARK: segues
// MARK: Segues
extension ImageCollectionViewController {

@@ -343,6 +377,8 @@ extension ImageCollectionViewController: ZoomAnimatorDelegate {
os_log("`ZoomAnimatorDelegate` is finishing.", log: Log.imageCollectionVC, type: .info)
}

/// Retrieve the cell at `currentIndex` for a zoom animation.
/// - parameter zoomAnimator: The `ZoomAnimator` object organizing the transition animation.
func getCell(for zoomAnimator: ZoomAnimator) -> ImageCollectionViewCell? {

let indexPath = zoomAnimator.isPresenting ? collectionView.indexPathsForSelectedItems?.first : IndexPath(item: currentIndex, section: 0)
@@ -376,34 +412,59 @@ extension ImageCollectionViewController: ZoomAnimatorDelegate {
// MARK: ImagePagingCollectionViewControllerDelegate
extension ImageCollectionViewController: ImagePagingCollectionViewControllerDelegate {

/// Respond to a change in index of the current image when in the paging view.
/// - parameters:
/// - containerViewController: The view controller that called the function.
/// - currentIndex: The index of the paging view controller. `self.currentIndex` is assigned this value to stay in sync.
///
/// - TODO: change name of first parameter to `imagePagingCollectionViewController`
func containerViewController(_ containerViewController: ImagePagingCollectionViewController, indexDidChangeTo currentIndex: Int) {
self.currentIndex = currentIndex
os_log("Setting new current index value.", log: Log.imageCollectionVC, type: .info)
collectionView.scrollToItem(at: IndexPath(item: currentIndex, section: 0), at: .centeredVertically, animated: false)
}

/// A notification from the `ImagePagingCollectionViewController` to delete the image at an index.
/// - parameter index: Index at which to delete the image.
///
/// - Note: The image is already deleted from the plant, erased from disk, and removed from `images: [UIImage]`. The only task to be done, here,
/// is to remove the image from the collection view using `collectionView.deleteItems(at: [IndexPath])`.
///
/// - TODO: add first paramter as `_ containerViewController: ImagePagingCollectionViewController`
func removeCell(at index: Int) {
collectionView.deleteItems(at: [IndexPath(item: index, section: 0)])
}
}



// MARK: SaveEditedImageDelegate
// MARK: EditedImageDelegate
extension ImageCollectionViewController: EditedImageDelegate {

/// Set the profile or the `plant: Plant` using the image at the specified index of `images: [UIImage]`.
/// - parameter index: index of `images: [UIImage]` for which to pull the image for the profile image.
func setProfileAs(imageAt index: Int) {
plant.profileImage = plant.images[index]
plantsManager.savePlants()
}

/// Delete an image from `plant: Plant` at the specific index.
/// - parameter index: index of `images: [UIImage]` and the `plant: Plant` object's image array.
func deleteImage(at index: Int) {
images.remove(at: index)
let imageUUID = plant.images[index]
plant.deleteImage(with: imageUUID)
plantsManager.savePlants()
}

/// Save changes to an image at the specific index.
/// - parameter image: The new (edited) image to replace the old one with.
/// - parameter index: The index of the image being replaced.
///
/// - Note: The image is *replaced*, not appended. Therefore, it retains the same file name and UUID. Therefore, anything that
/// references this image (eg. the header image) will be affected by the change.
func save(image: UIImage, withIndex index: Int) {
let fileURL = getFileURLWith(id: plant.images[index])
images[index] = image

0 comments on commit 5977d39

Please sign in to comment.
You can’t perform that action at this time.