translated first attributed string example to Swift