Godfather
Godfather

Reputation: 4340

Access a class from a different target with marked as "public"

I created a new target and added a class with the access modifier "Public". But i can't see this class.

http://s23.postimg.org/ikqn0zlvu/Screen_Shot_2015_02_27_at_12_27_28.jpg

From the docs i read "public entities are intended for use as API, and can be accessed by any file that imports the module, e.g. as a framework used in several of your projects." So my guess is that im not importing the module/target?

https://developer.apple.com/swift/blog/?id=5 https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/AccessControl.html

Upvotes: 7

Views: 5021

Answers (1)

MeloS
MeloS

Reputation: 7938

public accessor control doesn't mean "public across target", it means public in "linked object files".

You need to select your FooClass.swift file and on the right in the File inspector, there is a Target Membership, you should check all the target that you want the file to be used.

Upvotes: 19

Related Questions