UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

DAY 10

Classes


At first, classes seem very similar to structs because we use them to create new data types with properties and methods. However, they introduce a new, important, and complex feature called inheritance – the ability to make one class build on the foundations of another.

This is a powerful feature, there’s no doubt about it, and there is no way to avoid using classes when you start building real iOS apps. But please remember to keep your code simple: just because a feature exists, it doesn’t mean you need to use it. As Martin Fowler wrote, “any fool can write code that a computer can understand, but good programmers write code that humans can understand.”

Today you have eight one-minute videos to watch, and you’ll meet things like method overrides, final classes, and deinitializers. Once you’ve watched each video and optionally gone through the extra reading, there’s a short test to help make sure you’ve understood what was taught.

  1. Creating your own classes
  2. Class inheritance
  3. Overriding methods
  4. Final classes
  5. Copying objects
  6. Deinitializers
  7. Mutability
  8. Classes summary

Have some questions about classes?

Hit Send below to start a virtual conversation with me.

Need help? Tweet me @twostraws!

 

Hacking with Swift is sponsored by Proxyman

SPONSORED Proxyman: A high-performance, native macOS app for developers to easily capture, inspect, and manipulate HTTP/HTTPS traffic. The ultimate tool for debugging network traffic, supporting both iOS and Android simulators and physical devices.

Start for free

Sponsor Hacking with Swift and reach the world's largest Swift community!

100 Days of Swift


The 100 Days of Swift is a free collection of videos, tutorials, tests, and more to help you learn Swift faster. Click here to learn more, or watch the video below.

Back to 100 Days of Swift

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.