0

The documentation for UIView lists two initializers:

init(frame: CGRect)
init?(coder aDecoder: NSCoder)

According to my understanding, the compiler should force me to use one of those two. So, what gives? UIView is "special"?

Verticon
  • 2,419
  • 16
  • 34
  • 1
    UIView inherits from NSObject which has init(). – Mike Taverne Dec 13 '18 at 19:00
  • Mike If a class defines an initializer then initializer inheritance is blocked, yes? – Verticon Dec 13 '18 at 19:15
  • I don't know about blocked initializer inheritance. It might be different in Objective-C with things that inherit from NSObject. I wasn't certain which is why I offered a comment instead of an answer. :) – Mike Taverne Dec 13 '18 at 20:19
  • 1
    Check out "Automatic Initializer Inheritance" here: https://docs.swift.org/swift-book/LanguageGuide/Initialization.html – Verticon Dec 13 '18 at 21:05

0 Answers0