Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialWilliam Forbes
21,469 PointsExpected declaration
HELLO, I am still getting the error for expected declaration. Can someone assist? I have search the forums and the internet no luck.
import UIKit
class PlaylistMasterViewController: UIViewController {
@IBOutlet weak var A_button: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
A_button.setTitle("Press Me", forState: .Normal)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "showPlaylistDetail" {
let playlistDetailController = segue.destinationViewController as!PlayListDetailViewController
playlistDetailController.segueLabelText = "Ysy! You pressed the button"
}
}
2 Answers
Matthew Young
5,133 PointsYou're missing an additional closing curly brace at the bottom of your code.
Although this isn't a compiler issue with your code, you should add a space between "as!" and "PlayListDetailViewController".
William Forbes
21,469 PointsWow I am genuinely ashamed that is all it was and I didn't realize that. thank you!