Reputation: 55675
I'm surely missing something very simple here. I've created a custom class and want to provide an init method to set a property on the class - simple. But the init method is throwing a compile-time error: "Expected declaration". I don't see any differences with the latest version of the Swift programming guide. What's wrong here?
import UIKit
class MyClass: NSObject {
var thumbnailView: UIView
init(thumbnailView: UIView) { //ERROR: Expected declaration
self.thumbnailView = thumbnailView
}
}
Upvotes: 1
Views: 2858
Reputation: 93276
I asked BBEdit to zap your gremlins and it gave me back this:
class MyClass: NSObject {
var thumbnailView: UIView
init•(thumbnailView•: UIView) { //ERROR: Expected declaration
self.thumbnailView = thumbnailView
}
}
Two gremlins!
Upvotes: 4