Skip to content

How does key pointer address remain the same between get/set calls? #5

@suparngp

Description

@suparngp

A noob question may be.

Following up on your example:

var identifier: String {
      get {
          return getAssociatedValue(key: "identifier", object: self, initialValue: "Unknown")
      }
      set {
          set(associatedValue: newValue, key: "identifier", object: self)
      }
  }

"identifier" in both get and set should have different memory addresses since they are two different objects. So how is it able to retrieve the previously stored value?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions