Expected Declaration Error using Swift

The problem is that you need to put your code inside a method. All you need is to move it to viewDidLoad() or any other method.

Leave a Comment