Plant

class Plant : NSObject, Codable

Undocumented

  • A unique, unchanging identifier for the plant.

    Declaration

    Swift

    let uuid: String
  • The scientific name of the plant.

    Declaration

    Swift

    var scientificName: String?
  • The common name of the plant.

    Declaration

    Swift

    var commonName: String?
  • All of the images for the plant.

    Declaration

    Swift

    var images: [String]
  • Images that have been specifically Favorited by the user.

    Declaration

    Swift

    var favoriteImages: [String]
  • The profile image to use for the plant.

    Declaration

    Swift

    var profileImage: String?
  • The small, round image to use for an icon image.

    Declaration

    Swift

    var smallRoundProfileImage: String?
  • The growing season(s) of the plant.

    Declaration

    Swift

    var growingSeason: [Season]
  • The dormant season(s) of the plant.

    Declaration

    Swift

    var dormantSeason: [Season]
  • The difficulty level of the plant.

    Declaration

    Swift

    var difficulty: DifficultyLevel?
  • The water level(s) the plant can tolerate.

    Declaration

    Swift

    var watering: [WateringLevel]
  • The lighting level(s) the plant can tolerate.

    Declaration

    Swift

    var lighting: [LightLevel]
  • Date of purchasing the plant.

    Declaration

    Swift

    var purchaseDate: Date?
  • From whom/where the plant was purchased.

    Declaration

    Swift

    var purchasedFrom: Seller?
  • Notes about the plant.

    Declaration

    Swift

    var notes: String
  • Initialize a plant object with a scientific and common name.

    Declaration

    Swift

    init(scientificName: String?, commonName: String?)
  • Delete an image from a plant. The images: [UIImage] array just holds the UUIDs of the images. The file must specifically be deleted using a FileManager.

    Declaration

    Swift

    func deleteImage(with imageUUID: String)

    Parameters

    imageUUID

    The UUID of the image to be deleted. It is deleted from disk and all properties of the plant object that hold image UUIDs.

  • Delete all images from a plant.

    Important

    Make sure to offer the user a second chance before running this destructive task.

    Declaration

    Swift

    func deleteAllImages()
  • Prints a simple description of the plant.

    Declaration

    Swift

    func printSimpleDescription()
  • Get the best single image for a plant. The priority is as follows: profileImage> the first image of favoriteImages > the first image inimages.

    Declaration

    Swift

    func bestSingleImage() -> String?
  • A printable statement of the growingSeason property.

    Declaration

    Swift

    func printableGrowingSeason() -> String

    Return Value

    A single string with multiple growing seasons separated by commas.

  • A printable statement of the dormantSeason property.

    Declaration

    Swift

    func printableDormantSeason() -> String

    Return Value

    A single string with multiple dormant seasons separated by commas.

  • A printable statement of the watering property.

    Declaration

    Swift

    func printableWatering() -> String

    Return Value

    A single string with multiple waering levels separated by commas.

  • A printable statement of the lighting property.

    Declaration

    Swift

    func printableLighting() -> String

    Return Value

    A single string with lighting levels separated by commas.