Awesome
Float or Sink
Swift Student Challenge submission for WWDC-2021
The challenge was:
Create an interactive scene in a Swift playground that can be experienced within three minutes. Be creative.
This repo is what I submitted. I hope you enjoy it !
Theorical Concepts
Physicist's thoughts 🙇♂️
Have you ever minded why do some objects sink in water whileothers don't? 🤔 That was a question that triggered me until my hydrodynamicsclasses in highschool. Being able to understand and haveopportunity to explain to others what governs simple events suchas that satisfy me a lot. Because of that, in this playground Ipretend to teach you the physics behind the floatation (or not) ofobjects in water.
Join the lab! 👩🔬👨🔬
To teach you the physics of floatation, grab your coat 🥼 andenter the laboratory!
Press the start button to begin your experience. Pay attation atthe objects behaviour and at it's properties changes. Before youturn the page to pratice what you've learned, read the conclusionsbelow.
For a better experience, put your swift playgrounds app infullscreen mode.
What I've learned 📝
In this playground page, we did an experiment with an object inwater to study it behaviour. You've learned that wheter the totalof water displaced weighs more than the object which displacedthis amount of water, then the object floats. Else, the objectsinks.
That what you've just seen was stated by the greek Arquimedes along time ago (246 BC) in On Floating Bodies 📜
Any object, totally or partially immersed in a fluid or liquid,is buoyed up by a force equal to the weight of the fluid displacedby the object.
It is impressive how there were people with a scientific thoughtas advanced as Arquimedes in remote ages, isn't it?
If you want to go further in this subject, this article explains thephysics beyound what you've just seen here.
Pratice in SandBox
Welcome to Sandbox 🕹️
This playground page is a dedicated testing environment for you to apply what you've just learned in the previous page. Your object in SandBox is to guess what will be the behaviour of the ball in water: it will Float or Sink ❓
In SandBox you have the control of two parameters of the ball: Weight and Volume. Try out some combinations of values and see what happens. Stay in mind what you've seen in previous page:
Apparent Weight = Real Weight - Displaced Water Weight
You also have calculated the ball density, what is the relation between mass and volume. If I say that the water density is near to 1g/cm³, can you infer something?
Thanks for your time and attention!
😁
Credits and Acknowledgments
-
All the images were made by me at Figma. I want to thanks Quassum Manus for SVG-to-SwiftUI that helps me transpose the vectors images to SwiftUI Shapes
-
Thanks for Pedro Cacique's playlist of Swift Playgrounds. These videos helped me a lot to setup my playground project.
-
The font families used are provided in Apple platforms. In this project I used:
- Avenir
- Georgia