'_' is not convertible to StringLiteralConvertible

918 views Asked by At

My custom function is following:

func mockDictionaryForLocation() -> [String: AnyObject] {
    let dictionary = [
        "id" = "1234",  //here I have an error from the title, why?
        "working_type" = "open_for_selected",
        "min_order_price" = 15,
        "specialization_breakfasts" = 1,
        "specialization_confectioneries" = 1,
        "specialization_dinners" = 0
    ]



    return dictionary
}

enter image description here

1

There are 1 answers

0
biedert On BEST ANSWER

You need to use colons instead of equals:

func mockDictionaryForLocation() -> [String: AnyObject] {
    let dictionary = [
        "id": "1234",
        "working_type": "open_for_selected",
        "min_order_price": 15,
        "specialization_breakfasts": 1,
        "specialization_confectioneries": 1,
        "specialization_dinners": 0
    ]
    return dictionary
}