[swift-users] dynamic requires @objc in Framework, but not in monolithic project

Rick Mann rmann at latencyzero.com
Wed Sep 13 17:55:20 CDT 2017

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

More information about the swift-users mailing list