ekramramu
5/18/2018 - 7:55 AM

dictonray.swift

struct DailyShoping {
    var info:[String:Any] = ["Apple":100,"Oranage":130,"banana":90,"Water Milan":"Gift"]
    subscript (key:String) -> Any {
        get {
            if let newValue = info[key] {
                return newValue
            } else {
                return 0
            }
        }
    }
}