When declaring a variable as dynamic:
dynamic var myProperty: Bool = true is there any advantage or change in behavior by also adding the @objc marker?
@objc dynamic var myProperty: Bool = true In Swift 4, dynamic variables will give a compilation error if they do not have the @objc attribute on them. So, you could say the ability to compile is an advantage of adding @objc.
dynamic behavior is to also be @objc. dynamic implies @objc, but Swift 4 just makes this explicit.@objc there does not cause any harm in Swift 3, and it makes your life easier when it comes time to update your code. So I would not call it superfluous at all.See Apple's documentation itself. It states
Declarations marked with the dynamic modifier must also be explicitly marked with the @objc attribute unless the @objc attribute is implicitly added by the declaration’s context. For information about when the @objc attribute is implicitly added. See Declaration Attributes