The first approach is called the so-called computed property :
Classes, structures, and enumerations can define computed properties that do not actually hold value. Instead, they provide a getter and an additional installer to retrieve and set other properties and values indirectly.
The form you use provides only getter for string1, which makes it read-only.
:
, . ( var), ( let).
- ( var).
, . (, , ).