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 trialLinus Karlsson
7,402 PointsERROR: Use of undeclared type 'Date'?
When I follow the instructions as precise as I can I still get the error message "Use of undeclared type 'Date' " on line #32 and #35.
Why is this? I'm using Xcode version Version 9.2 (9C40b).
protocol FullNameable {
var fullName: String { get }
}
struct User: FullNameable {
var fullName: String
}
let user = User(fullName: "John Smith")
struct Friend: FullNameable {
let firstName: String
let middleName: String
let lastName: String
var fullName: String {
return "\(firstName) \(middleName) \(lastName)"
}
}
let friend = Friend(firstName: "Taylor", middleName: "Alison", lastName: "Swift")
friend.fullName
enum EmployeeType {
case manager
case traditional
}
class Employee {
let name: String
let address: String
let startDate: Date
let type: EmployeeType
init(name: String, address: String, startDate: Date, type: EmployeeType) {
self.name = name
self.address = address
self.startDate = startDate
self.type = type
}
}
1 Answer
elena meneghini
iOS Development with Swift Techdegree Student 9,832 PointsThanks Linus, I had the same error!
Linus Karlsson
7,402 PointsLinus Karlsson
7,402 PointsEasy fix!
import Foundation