Apologies for the title gore, but I can't really think of any other way to phrase it.
I am a Swift noob and am trying to make a silly little program for practice.
Anyway, I have superclass which I plan on creating several other classes inserting the function from it but overriding the properties. I have a function that combines the properties from all the class, but I would like to be able to use the class name within the function and am completely clueless as to how to actually do this.
I have searched the documentation but did not find anything conclusive. If possible, I would also like to make the class name lowercase without actually changing the class name. Perhaps (with my vague knowledge of Python) something similar to .lower
My attempt is below:
class FoodItem {
var ingredientOne: String = "Default ingredient."
var ingredientTwo: String = "Also a default ingredient."
var ingredientThree: String = "Another default ingredient."
func returnStatement() -> String {
return "A classnamegoeshere is made from \(ingredientOne), \(ingredientTwo), and \(ingredientThree)"
}
}