Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Protocols in Swift Protocol Basics Why Are Protocols Useful?

ERROR: 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")

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

Easy fix!

import Foundation

1 Answer