Swift - best way to handle a dictionary of dictionaries?
<p>I have an array of people that all have a list of favourite books.
Each book has several properties, such as book title, book description, book author.</p>

<p>What I want to do is create a dictionary of dictionaries to be able to access a specific person, and then access each book of that person and extract the book name, book title author etc from that that.</p>

<p>currently what I am doing is the declaring a dictionary like so:</p>

<pre><code>var dictToHoldBooKValue = [String : [String : AnyObject]]()
</code></pre>

<p>the first String is the key, which I will create as the name of the person, the second pard is a dictionary, which will have a key of type string (which I will set as the book property name like "book Title" or "book author" and the any object is the value of that key.</p>

<p>example: I modify the dictionary like so:</p>

<pre><code>dictToHoldBooKValue["Mark"] = ["book Title" : (bookTitle as? String)]
</code></pre>

<p>However, this approach does not seem to be working because "Mark" has several books he likes and so when I print the dict count it only shows one. Also, I have no idea how I would use this dict to to get at the book author property or any other property. </p>

<p>Anybody know a more elegant solution?</p>

<p>Thanks!</p>