Write a Playground file in SWIFT to create a dictionary for at least 5 products, in which
Question:
Write a Playground file in SWIFT to create a dictionary for at least 5 products, in which each key is a product name (e.g., “Stawberry Icecream”) and each value is a tuple including the category and price of the corresponding product (e.g., (“Dissert”, 3.99))
Declare three functions:
lowestPrice function returns name and price of the product that has the lowest price among all given products.
highestPrice function returns name and price of the product that has the highest price among all given products.
price function takes a product dictionary and a reference to a function as arguments. It returns the information (i.e., product name and price) of the product that has either the lowest price or the highest price.
call function price and pass a reference to lowestPrice function, and make sure you get the correct returned value.
call function price and pass a reference to highestPrice function, and make sure you get the correct returned value.