1

Today, I upgraded to Xcode 10. The same project that was compiling earlier today with my Xcode 9.x now complains about nearly all of my initializers in Xcode 10.1.

I have tried cleaning the project and rebuilding, no luck. I have played around with the compiler optimization level, no luck.

Example code: snippet_1

The same code in a fresh Xcode 10 project compiles just fine. Other instances of the compiler error:

let b = UIButton() // throws "Cannot invoke initializer for type 'UIButton' with no arguments"
//1. Overloads for 'UIButton' exist with these partially matching parameter lists: (type: UIButtonType), (frame: CGRect), (coder: NSCoder), (with: UIColor), (with: ThemeColorPicker)

let l = UILabel() // throws "Cannot invoke initializer for type 'UILabel' with no arguments"

var safeAreaLayoutGuideBottom = UIView()// throws "Cannot invoke initializer for type 'UIView' with no arguments"
mikemags1
  • 797
  • 6
  • 13
  • 2
    I'm having the same freakin' problem! All of craps that I'm having right now (this is for an old Swift 4.0 project, trying to get migrated to Swift4.2) came from this very error. As a matter of fact, I have posted a question about it, and answered my own question but it seems that my answer is not correct. I saw this question since I'm following the tag Xcode 10. – Glenn Posadas Nov 26 '18 at 19:19
  • Please post your code as text, not as a picture. – rmaddy Nov 26 '18 at 19:44
  • 1
    `UIView` has never actually supported an empty initializer. It's just that it's being enforced better now. – rmaddy Nov 26 '18 at 19:47
  • Thank you @rmaddy I am aware that the empty initializer was never officially supported. However, that is not the issue as made clear by the second code block. Empty initializers for UIView subclasses compile just fine in Xcode 10. – mikemags1 Dec 04 '18 at 20:27

0 Answers0