Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 746
Scott McKenzie Avatar asked Oct 16 '25 13:10

Scott McKenzie


1 Answers

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
}
like image 158
nhgrif Avatar answered Oct 19 '25 05:10

nhgrif



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!