0

Okay so I have an error with my extension, which whenever I add a line or space it up it creates more errors with the UIColor. I can use the Clean function to get it back down to these two errors. My extension is not in {} and I think I have all my blocks closed, but maybe not. It was working fine before I made 'FIRAuth Create User' function if that has anything to do with it. Issue Navigator + the Code

extension UIColor{

    convenience init (r: CGFloat, g: CGFloat, b: CGFloat) {
        self.init(red: r/255, green: g/255, blue: b/255, alpha: 1)
    }

}
Darin Wilson
  • 169
  • 1
  • 2
  • 9

1 Answers1

1

Is a previous block perhaps missing a close curly brace? If a preceding class or extension is still open, then this extension isn't at file scope – it's one level deeper, which is invalid. I'd double-check that all of your preceding scopes are closed as you expect.

Tim
  • 59,527
  • 19
  • 156
  • 165
  • Is there a quick way to do that besides looking through your code slowly... like way you can highlight and closing Curly and it will highlight the corresponding open Curly? – Darin Wilson Oct 05 '16 at 19:18
  • I'd select everything in the file and hit Control+I, which will automatically reindent your code. Then you can glance through and see the point where everything suddenly shifts an extra tab to the right. – Tim Oct 06 '16 at 04:20
  • In addition, Xcode allows you to expand & collapse scopes using the left gutter of the source editor. You can also highlight the contents of a pair of braces by double-clicking on either brace. – Tim Oct 06 '16 at 04:20