[swift-users] dynamic requires @objc in Framework, but not in monolithic project
hooman at mac.com
Wed Sep 13 19:06:37 CDT 2017
When you create a new project in Xcode 9, the defaults for compiler settings are different. The errors you see are the result of running in full (strict) Swift 4.0 mode which has some such breaking changes.
> On Sep 13, 2017, at 3:56 PM, Rick Mann via swift-users <swift-users at swift.org> wrote:
> I have an iOS app in which I'm factoring out code into a Framework. In Xcode 9 GM (Swift 4), the code builds fine when it's a monolithic app, but some of the files I've pulled into the framework are no longer compiling. One of the errors is:
> Model.swift:471:14: 'dynamic' var 'dateCreated' must also be '@objc'
> The class looks like:
> import Foundation
> MPObject : NSObject
> dynamic var dateCreated : Date?
> If I add @objc to each dynamic member, it seems to silence the errors, but the @objc should be implicit due to inheriting from NSObject, and as I said, it builds without error as a monolithic app.
> Rick Mann
> rmann at latencyzero.com
> swift-users mailing list
> swift-users at swift.org
More information about the swift-users