Junior
Tell about two semantics in Swift.
sobes.tech AI
Answer from AI
Value Semantics
Objects with value semantics are copied when assigned or passed to a function. Each copy is independent of the original. Structures (struct) and enumerations (enum) in Swift have value semantics.
Reference Semantics
Objects with reference semantics share a reference to the same memory area. When assigned or passed to a function, a new reference to the existing object is created. Changes through one reference are visible through another. Classes (class) in Swift have reference semantics.