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 trialBrian Uribe
3,488 PointsWhere to start?
I'm not sure where to start with this. I took a shot and i'm falling flat
import Foundation
enum UIBarButtonStyle {
case Done
case Plain
case Bordered
}
class UIBarButtonItem {
var title: String?
let style: UIBarButtonStyle
var target: AnyObject?
var action: Selector
init(title: String?, style: UIBarButtonStyle, target: AnyObject?, action: Selector) {
self.title = title
self.style = style
self.target = target
self.action = action
}
}
let done = enum Done: String {
}
enum Button {
case Done(String)
case Edit(String)
}
1 Answer
J.D. Sandifer
18,813 PointsOne place to start if you're having trouble is re-reading the directions. Sometimes there's a ton of information packed in there and it's easy to miss key points. I often find myself re-reading them a couple times before I start on some problems.
Take a look at this problem's first line of directions again:
"In the editor you've been provided with two files: buttons.swift that contains some source code for you to use, and enums.swift where you will be writing code."
After you figure out what needs to change there, here's the way you want to assign the Enum to the constant:
let constant = Enum.Type
(that's not the actual code, you'll need to fill in the correct names for constant, Enum, and Type to fit this problem)