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 trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Aananya Vyas](https://uploads.teamtreehouse.com/production/profile-photos/7550172/micro_IMG_6129.jpg)
Aananya Vyas
20,157 Pointsit shows this in the preview what am i doing wrong??
swift_lint.swift:8:27: error: expected '{' to start getter definition var count : Int {get} ^ my code:
struct Queue<Element> {
var array: [Element] = []
var isEmpty: Bool {
if array.count == 0 {
return true
} else {
return false
}
}
}
struct Queue<Element> {
var array: [Element] = []
var count : Int {get}
var isEmpty: Bool {
if array.count == 0 {
return true
} else {
return false
}
}
}
1 Answer
![miikis](https://uploads.teamtreehouse.com/production/profile-photos/2019582/micro_28997062.jpg)
miikis
44,957 PointsHi Aananya,
It looks like you copy-and-pasted a protocol declaration inside of your struct. Remove the {get} after your count declaration and you should be fine :)
Aananya Vyas
20,157 PointsAananya Vyas
20,157 Pointsit works in xcode.. not here..have tried it before .
miikis
44,957 Pointsmiikis
44,957 PointsThe Challenge is asking you to make count a computed-property... like you did for isEmpty. Let me know if that helps. Also, for isEmpty, you don't have to manually check the array's count— you can just return array.isEmpty.