Understanding structures
Like classes, structures also group together properties and methods used to represent an object and do specific tasks. Remember the Animal class you created? You can also use a structure to accomplish the same thing. There are differences between classes and structures though, and you will learn more about those later.
Here's what a structure declaration looks like:
struct StructName {
property1
property2
property3
method1() {
code
}
method2(){
code
}
}
As you can see, a structure declaration is very similar to a class declaration.
Important information
To learn more about structures, visit https://docs.swift.org...