Requires a pro subscription Pro

Advanced Swift: Unsafe Memory Access

Did you know you can call C-malloc straight from Swift? Swift lets access the machine at its lowest level. This course will show you how. By Ray Fix.

Login to leave a rating/review
Save for later
Share

Learning path

This is part of the Advanced Swift learning path. View Path.

Who is this for?

This course is for developers interested in getting a deeper understanding of the Swift language. It expects you to be comfortable with the basic syntax of Swift and to have perhaps written an app or two. You should be familiar with basic types in the Swift standard library.

Covered concepts

This course focuses on:

  • Best practices for memory safety
  • Pointer types
  • Unsafe Swift and why not to use it

1
Toggle description

Swift is safe by default. Sometimes you may need to forgo this safety for extra performance or to interact with an unsafe language such as C.

Toggle description

When you are working with with unsafe code, you need to concern yourself with the size of objects in memory.

Toggle description

In this video we will explore the fundamentals of unsafe memory access, and learn about the types involved.

Toggle description

When you are using memory unsafely, the compiler no longer provides guarantees and you must follow basic rules to avoid undefined behavior.

Toggle description

It's time for a challenge! See if you can use your unsafe Swift skills to wrap a data compression C-API.

Conclusion 1:51
Toggle description

Unsafe Swift lets you access raw memory. While it requires extra diligence, you can keep such places small and isolated.