0

How to add property attributes e.g nonatomic in swift?

Property Declaration in Objective-C

@property(strong, nonatomic) NSString *name;

How to declare above instance property with nonatomic attribute in swift?

1
  • Swift properties are non atomic by default. Commented Nov 20, 2018 at 6:51

2 Answers 2

1

Swift properties are non atomic by default.

Atomicity property attributes (atomic and nonatomic) are not reflected in the corresponding Swift property declaration, but the atomicity guarantees of the Objective-C implementation still hold when the imported property is accessed from Swift.

source: medium.com

Sign up to request clarification or add additional context in comments.

Comments

0

Swift does not have that in the same extent.

You can specify some modifiers though.

var value: Int
private var value: Int
weak var value: Int?
lazy var value: Int = 0

etc.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.