allenlinli
allenlinli

Reputation: 2154

Why do we need to mark a Swift class `public` or `open` to make it accessible in an Objective-C framework project?

As title.

But based on Apple's doc, it says:

Methods and properties that are marked with the internal modifier and declared within a class that inherits from an Objective-C class are accessible to the Objective-C runtime.

It says internal should work.

Did I misunderstand something?

Upvotes: 0

Views: 404

Answers (1)

Cy-4AH
Cy-4AH

Reputation: 4585

Classes will be accessible to runtime, but not to programmer. You will need class headers to operate with them. Xcode will just generate public Objective-C headers for you, if you mark them as public.

Upvotes: 2

Related Questions