Initialize class-instance and access variables in Swift

后端 未结 2 1538
借酒劲吻你
借酒劲吻你 2020-12-07 03:50

I just created a class and gave it some vars. Unfortunately I can\'t access these variables in my iOS-Projects. However, the same syntax works in playground...<

2条回答
  •  醉梦人生
    2020-12-07 04:02

    The last two lines need to be inside a function. You can have only declarations in class scope, not expressions to be executed.

提交回复
热议问题