1
import UIKit

class ImageAnimation: UIViewController {


    @IBOutlet weak var IMGs: UIImageView!


    override func viewDidLoad() {
        super.viewDidLoad()
        IMGs.animationImages = [#imageLiteral(resourceName: "IMG1.jpg"),#imageLiteral(resourceName: "IMG2.jpg"),#imageLiteral(resourceName: "IMG3.jpg"),#imageLiteral(resourceName: "IMG4.jpg")]
        IMGs.animationDuration = 1.0
        IMGs.animationRepeatCount = 25
        IMGs.startAnimating()

    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
}

I get Expected Declaration (Error) at "override func viewDidLoad() {" How to fix this problem

2
  • 3
    I have copied your code into an Xcode 9.1 iOS project and it compiled without problems. Commented Nov 5, 2017 at 12:16
  • 1
    I have XCode 9.0 and the code is compiling in it as well. I guess you need to include more details. Commented Nov 5, 2017 at 12:19

1 Answer 1

1

try to clean project and compile again. to do that hit ⌘ + Shift + K.
or
rm -rf ~/Library/Developer/Xcode/DerivedData from command line.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.