Home > AI > Language > Swift >

unsafe swift

This article is sourced from Raywenderlich tutorial. https://www.raywenderlich.com/7181017-unsafe-swift-using-pointers-and-interacting-with-c

By default, Swift is memory safe: It prevents direct access to memory and makes sure you’ve initialized everything before you use it. The key phrase is “by default.” You can also use unsafe Swift, which lets you access memory directly through pointers.

Memory system

each memory is like a box and has a unique memory address. Its size unit is 1 byte (8 bits). On a 64 bit machine, a word is 8 bytes (or 64 bits).

Guide to unsafe swift pointers
Source: https://www.raywenderlich.com/7181017-unsafe-swift-using-pointers-and-interacting-with-c

Leave a Reply