Open ViewController.swift from the File Inspector.
Without touching the Main.storyboard file, figure out a way to change the Image View using code to display the ball3 image when the Ask Button is pressed.
Hint: 1. There are a total of 5 ball images. You can find them in the Assets.xcassets folder.
Hint 2: Remember to use the dot notation you learnt in Dicee to change the image.
Who Dot What = Value
Hint 3: The Image View is the Who. You can check its name in the IBOutlet.
Hint 4: The What corresponds to properties in the Attribute Inspector.
Hint 5: Type Image Literal to get the image selector to show up.
Run the App and check that the “ball3” image is displayed in the Image View when you press the Ask button.
IMPORTANT
Don’t be too quick to check the solution in the Dicee tutorial. Mess around with the code. You won’t break anything. Be brave. Try different combinations. Test things out. Run the app each time you change something. See if what your app is doing is what you expected. If not, try and figure out why not. Fix your code and repeat.
This is the most important part of learning to code. It’s much like cooking. You can learn to make cakes with recipes in the beginning, but you only become a chef when you start making your own creations without a recipe. Right now, don’t aim for 3 Michelin stars. Aim for edible.
GOAL