Here I create a Swift Dictionary.
var paramDict: [String: String] = [
"tour_type": "tour",
"zone_id": txtRegoin.tag.description,
"district_from_id" : txtLocationFrom.tag.description,
"district_to_id" : txtLocationTo.tag.description,
"start_date" : selectedStartTime.toString(dateFormat: BBTIMESTAMP_YYYYMMDD),
"start_time" : selectedStartTime.toString(dateFormat: BBTIMESTAMP_HH_MM),
"return_date" : selectedEndTime.toString(dateFormat: BBTIMESTAMP_YYYYMMDD),
"return_time" : selectedEndTime.toString(dateFormat: BBTIMESTAMP_HH_MM),
"vehicle_type" : vehicleObjArr[selectedVehicleObj].brand!,
"capacity" : (vehicleObjArr[selectedVehicleObj].capacity?.description)!,
"comment" : textDetails.text ?? "",
"passengers" : numOfPassengers.description
]
If I debubg the dictionary.
po paramDict
▿ 14 elements
▿ 0 : 2 elements
- key : "passengers[0]"
- value : "27785"
▿ 1 : 2 elements
- key : "zone_id"
- value : "1"
▿ 2 : 2 elements
- key : "return_time"
- value : "13:20"
▿ 3 : 2 elements
- key : "start_date"
- value : "2020-07-01"
▿ 4 : 2 elements
- key : "start_time"
- value : "13:20"
▿ 5 : 2 elements
- key : "capacity"
- value : "7"
▿ 6 : 2 elements
- key : "district_from_id"
- value : "1"
▿ 7 : 2 elements
- key : "return_date"
- value : "2020-07-02"
▿ 8 : 2 elements
- key : "tour_type"
- value : "tour"
▿ 9 : 2 elements
- key : "passengers"
- value : "7"
▿ 10 : 2 elements
- key : "district_to_id"
- value : "3"
▿ 11 : 2 elements
- key : "vehicle_type"
- value : "Sedan"
▿ 12 : 2 elements
- key : "comment"
- value : "Ads adds"
▿ 13 : 2 elements
- key : "passengers[1]"
- value : "23132"
This is not well readable format. Especially if you send this dictionary to your backend developer.ie. I am facing a post problem and multiple times gave my dictionary which printed on debug mode. Its not good readable formatted output.
So, How it possible to good looking readable format?