Scott McKenzie
Scott McKenzie

Reputation: 16242

Why doesn't my Swift struct property appear in framework?

I have declared a Swift struct in a framework, like so:

public struct Thing {
  var myProperty: String
}

I can access this in the framework tests without issue.

However, when I link to this framework in an iOS app only this appears in the header:

public struct Thing {
}

Any ideas?

Upvotes: 4

Views: 1085

Answers (1)

nhgrif
nhgrif

Reputation: 62062

The default access level is internal. You must mark your property as public if you want it to show up outside the module.

public struct Thing {
    public var myProperty: String
}

Upvotes: 9

Related Questions