1

My function has following return type: [String: [String: String]]

However I have to initialize it first but how to do this?

var results : [String: [String: String]] = ?
3
  • 1
    var results: [String: [String: String]] = [:] Commented Feb 16, 2016 at 14:07
  • 4
    It's not a multidimensional array at all, it's a dictionary where values are also dictionaries. There's no array here. And to init, just do var results : [String: [String: String]] = [:]. Commented Feb 16, 2016 at 14:07
  • 3
    Possible duplicate of Swift: declare an empty dictionary (see @Suragch's answer) Commented Feb 16, 2016 at 14:10

1 Answer 1

4

You could simply use the following syntax :

var results = [String: [String: String]]()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.