A framework for converting and interpreting common measurements used in cooking.
The framework consists of several protocols that define specific types and behaviors.
Component Protocols:
Descriptive: Properties that describe and categorize an element.Multimedia: Protocol for interactive with element images.Proportioned: Parameters that indicate a volume-to-weight ratio.Quantifiable: Parameters that indicate a 'measurement'.Sequenced: Properties that describe the order of elements.Unique: The properties needed to determine uniqueness of elements.
Collective Protocols:
Ingredient: Represents any raw material/ingredientFormulaElement: A measurement of someIngredientorRecipe.ProcedureElement: A step in the preparation of aRecipe.Recipe: A compilation of measurements and procedures.
Fraction: Commonly used fractions (¼, ½, ⅔, etc.)Integral: Commonly used integrals for quick entry.MeasurementMethod: Representation of the ways in which something can be measured.MeasurementSystem: The types of systems used to measure (US, Metric)MeasurementSystemMethod: Combined representation of a measurement 'system' and 'method'.
Understanding the volume-to-weight ratio of Ingredients is the key to scaling and transforming acurately.
Water, for instance, has a 1:1 ratio, meaning that 1 Ounce (or gram) is equal to 1 Fluid Ounce (or milliliter).
Whereas All Purpose (Plain) Flour takes up more volume than it weighs; a ratio of 1.882:1.
This ratio allows for the transofmration of any measurement of an ingredient into another system. Tablespoons, Cups, and Pounds can be converted into Grams or Milliliters (or the other way around).
A formula is the collection of measured Ingredients (or other Recipes) for a specific Recipe. A simple Italian Bread has the formula:
- 1.8 kg AP/Plain Flour
- 28 g Active Dry Yeast
- 28 g Salt
- 955 mL Water
The elements about can produce 1 large loaf or two small loaves weighing a total of 702.5 Grams.
But, what if you wanted 5 small loaves? This is where scaling a Recipe comes in.
let recipe: Recipe
let scaledFormula: [FormulaElement] = recipe.scale(by: 2.5)
// 4.5 kg Flour
// 70 g Yeast
// 70 g Salt
// 2388 mL WaterMiseEnPlace is distributed using the Swift Package Manager. To install it into a project, add it as a dependency within your Package.swift manifest, or through Xcode:
let package = Package(
…
dependencies: [
.package(url: "https://github.com/richardpiazza/MiseEnPlace.git", .upToNextMajor(from: "6.0.0"))
],
…
)Then import MiseEnPlace wherever you'd like to use it:
import MiseEnPlace