Classes
The following classes are available globally.
-
This is a simple ball object that has a volume property.
It also illustrates how to make a class Hashable (so it can be stored in sets, as keys of Maps, etc.), and how to enable it to be printed in a meaninful way.
Note the computed properties for the implemented Protocols. This will be a common pattern for your classes.
See moreDeclaration
Swift
public class Ball : Hashable, CustomStringConvertible
-
This is a container can be used to contain Balls. A Ball with a particular volume and color may only appear in a BallContainer once.
See moreDeclaration
Swift
public class BallContainer : Sequence