openpublic classes and class members can only be subclassed and overridden both within and outside the defining module (target). publicopen classes and class members can only be subclassed and overridden both within and outside the defining module (target).
// First.framework – B.swift public class B: A {} // ok
// Second.framework – C.swift import First internal class C: A {} // ok
// Second.framework – D.swift import First internal class D: B {} // error: B cannot be subclassed
Enables an entity to be used withinwithing the defining module (target). You typically use internal access when defining an app’s or a framework’s internal structure.
// First.framework – A.swift internal struct A { fileprivate static let x: Int } A.x // ok
// First.framework – B.swift A.x // error: x is not available
// First.framework – A.swift internal struct A { private static let x: Int internal static func doSomethingWithX() { x // ok } } A.x // error: x is unavailable