I'm learning iOS and ran into this question for the Access Control part. Here's the example:
class MyClass: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
}
When making a subclass of UIView, it's very common to see those override/required init
override init(frame: CGRect)
required init?(coder aDecoder: NSCoder)
but those are declared in UIView interface file as public access like here.
open class UIView: UIResponder, ... {
...
public init(frame: CGRect)
public init?(coder aDecoder: NSCoder)
...
And obviously according to Swift language guide
Class members with public access, or any more restrictive access level, can be overridden by subclasses only within the module where they’re defined.
So my question is, how could possible to override them(public init) within an external module?