Extension not working

Why extension not working in my playground ? , I´m reading the swift book , and I with extension , but when I try to do a extension to a class , the compiler said to me , that declaration is only valid at file scope ,what that means ? thank you for your time

Accepted Reply

Protocols cannot be nested and file scope is effective even in non-Playground projects in Swift.

Replies

Please show your code. As the error is about file scope, you should better show in which file the code exists.

And i have a similar problem with protocol , but here said to me : cannot be nested

Maybe the problem is that i´m in PlayGround ?? thanks

Protocols cannot be nested and file scope is effective even in non-Playground projects in Swift.