How do a conform to a protocol that declares property of type protocol?
<p>I'm trying to create a protocol and a couple of classes that conform to it. The protocol has an property which conforms to another protocol so the classes each need to have a property that matches.</p>

<p>This is (something like) what I'm trying so far:</p>

<pre><code>protocol Edible {
    func eat()
}

class Apple:Edible {
    func eat() {
        print("Crunch")
    }
}

class Banana:Edible {
    func eat() {
        print("Homph")
    }
}

protocol Delicious {
    func consume()

    var fruit: Edible? { get set }
}    

class ToffeeApple: Delicious {
    func consume() {
        print("I like toffee apples!")
        fruit.eat()
        // ...
    }

    var fruit: Apple?
}

class BananaSplit: Delicious {
    func consume() {
        print("Ah! A banana split!")
        fruit.eat()
        // ....
    }

    var fruit: Banana?
}
</code></pre>

<p>The (relevant) error I'm getting is "Type 'ToffeeApple' does not conform to protocol 'Delicious'" (and the same for Banana and BananaSplit too). I thought the properties <code>Apple</code> and <code>Banana</code> would satisfy the requirements as they both conform to <code>Edible</code> as as <code>fruit</code> does. Am I declaring one of these incorrectly or is this not possible?</p>

<p>Many thanks.</p>