Posts

Post not yet marked as solved
1 Replies
681 Views
So i have been looking at the playground on iPad. You can change functions and so on but not all is clear. In the Sensor Arcade project where do the mushrooms come from and how can I change the images of mushrooms and the player? Also I want to make the project my own so to speak so I can continue to work on it. How do I do that?
Posted
by net777.
Last updated
.
Post not yet marked as solved
3 Replies
1.3k Views
I am a beginner and I´m following a course.They use a project where the labels an so on where already set.I wanted to make some changes but when I run the app they doesn't show.
Posted
by net777.
Last updated
.
Post marked as solved
2 Replies
652 Views
So I would like to have several values in one TableView cell. Something like:Name category price.How do I do that?Or are there a better way?
Posted
by net777.
Last updated
.
Post marked as solved
5 Replies
1.1k Views
So I'm taking a course to learn iOS-programming.In the course they use Alamofire and SwiftyJSON.I have this:func getTrainData(url: String) { Alamofire.request(url).responseJSON { response in if response.result.isSuccess { //print("Success! Got the train data") let trainJSON : JSON = JSON(response.result.value!) self.updateTrainData(json: trainJSON) print(trainJSON) } else { print("Error \(String(describing: response.result.error))") self.cityLabel.text = "Connection problem" } } }Tried to Google and found this:let json = "{ \"people\": [{ \"firstName\": \"Paul\", \"lastName\": \"Hudson\", \"isAlive\": true }, { \"firstName\": \"Angela\", \"lastName\": \"Merkel\", \"isAlive\": true }, { \"firstName\": \"George\", \"lastName\": \"Washington\", \"isAlive\": false } ] }"if let data = json.data(using: .utf8) { if let json = try? JSON(data: data) { for item in json["people"].arrayValue { print(item["firstName"].stringValue) } } }I don't know how to translate that to my JSON-resonse.So what I want is to be able loop through the response and pick some values.So maybe something like:if let data = json.data(using: .utf8) { if let json = try? JSON(data: data) { for item in json["Trip"][0]["LegList"]["Leg"][0]["Stops"]["Stop"][1]["name"].string { { print(item["name"].stringValue) } } }Here is the JSON-resonse (sorry for the many lines){ "Trip" : [ { "duration" : "PT58M", "tripId" : "C-0", "ctxRecon" : "T$A=1@O=Malmö Centralstation@L=740000003@a=128@$A=1@O=Hässleholm Centralstation@L=740000006@a=128@$201907051031$201907051129$JLT 1413$$1$", "LegList" : { "Leg" : [ { "type" : "JNY", "Destination" : { "extId" : "740000006", "date" : "2019-07-05", "lat" : 56.157761999999998, "routeIdx" : 16, "lon" : 13.763140999999999, "time" : "11:29:00", "id" : "740000006", "type" : "ST", "name" : "Hässleholm Centralstation" }, "transportNumber" : "1413", "Product" : { "catCode" : "4", "operator" : "Skånetrafiken", "num" : "1413", "operatorCode" : "276", "catOutL" : "Länstrafik - Tåg", "catOutS" : "JLT", "name" : "Länstrafik - Tåg 1413", "operatorUrl" : "http:\/\/www.skanetrafiken.se" }, "Stops" : { "Stop" : [ { "extId" : "740000003", "lat" : 55.609456000000002, "routeIdx" : 7, "depTime" : "10:31:00", "lon" : 13.000909999999999, "id" : "740000003", "name" : "Malmö Centralstation", "depDate" : "2019-07-05" }, { "extId" : "740000120", "arrTime" : "10:42:00", "arrDate" : "2019-07-05", "lat" : 55.708094000000003, "routeIdx" : 8, "depTime" : "10:44:00", "lon" : 13.186897, "id" : "740000120", "name" : "Lund Centralstation", "depDate" : "2019-07-05" }, { "extId" : "740000834", "arrTime" : "10:49:00", "arrDate" : "2019-07-05", "lat" : 55.751153000000002, "routeIdx" : 9, "depTime" : "10:49:00", "lon" : 13.200201, "id" : "740000834", "name" : "Stångby station (Lund kn)", "depDate" : "2019-07-05" }, { "extId" : "740000961", "arrTime" : "10:53:00", "arrDate" : "2019-07-05", "lat" : 55.778928999999998, "routeIdx" : 10, "depTime" : "10:53:00", "lon" : 13.243969, "id" : "740000961", "name" : "Örtofta station (Eslöv kn)", "depDate" : "2019-07-05" }, { "extId" : "740000260", "arrTime" : "10:58:00", "arrDate" : "2019-07-05", "lat" : 55.837719, "routeIdx" : 11, "depTime" : "10:59:00", "lon" : 13.305491, "id" : "740000260", "name" : "Eslöv station", "depDate" : "2019-07-05" }, { "extId" : "740000952", "arrTime" : "11:05:00", "arrDate" : "2019-07-05", "lat" : 55.900813999999997, "routeIdx" : 12, "depTime" : "11:05:00", "lon" : 13.394852999999999, "id" : "740000952", "name" : "Stehag station (Eslöv kn)", "depDate" : "2019-07-05" }, { "extId" : "740000185", "arrTime" : "11:10:00", "arrDate" : "2019-07-05", "lat" : 55.937023000000003, "routeIdx" : 13, "depTime" : "11:11:00", "lon" : 13.541395, "id" : "740000185", "name" : "Höör station", "depDate" : "2019-07-05" }, { "extId" : "740001611", "arrTime" : "11:17:00", "arrDate" : "2019-07-05", "lat" : 56.000315999999998, "routeIdx" : 14, "depTime" : "11:17:00", "lon" : 13.629849, "id" : "740001611", "name" : "Tjörnarp station (Höör kn)", "depDate" : "2019-07-05" }, { "extId" : "740001334", "arrTime" : "11:21:00", "arrDate" : "2019-07-05", "lat" : 56.036271999999997, "routeIdx" : 15, "depTime" : "11:21:00", "lon" : 13.680422, "id" : "740001334", "name" : "Sösdala station (Hässleholm kn)", "depDate" : "2019-07-05" }, { "extId" : "740000006", "arrTime" : "11:29:00", "arrDate" : "2019-07-05", "lat" : 56.157761999999998, "routeIdx" : 16, "lon" : 13.763140999999999, "id" : "740000006", "name" : "Hässleholm Centralstation" } ] }, "name" : "Länstrafik - Tåg 1413", "direction" : "Kristianstad Centralstation", "idx" : "0", "Notes" : { "Note" : [ { "key" : "VG", "type" : "A", "routeIdxTo" : 16, "priority" : 100, "value" : "Pågatågen", "routeIdxFrom" : 7 }, { "key" : "AA", "type" : "A", "routeIdxTo" : 16, "priority" : 100, "value" : "Endast 2 klass", "routeIdxFrom" : 7 }, { "key" : "AE", "type" : "A", "routeIdxTo" : 16, "priority" : 100, "value" : "Ej reservering", "routeIdxFrom" : 7 } ] }, "transportCategory" : "JLT", "reachable" : true, "Origin" : { "id" : "740000003", "extId" : "740000003", "date" : "2019-07-05", "lon" : 13.000909999999999, "time" : "10:31:00", "lat" : 55.609456000000002, "name" : "Malmö Centralstation", "routeIdx" : 7, "type" : "ST" } } ] }, "ServiceDays" : [ { "planningPeriodBegin" : "2019-07-01", "sDaysR" : "daily", "sDaysB" : "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE", "planningPeriodEnd" : "2019-12-14" } ], "idx" : 0 }, { "duration" : "PT58M", "tripId" : "C-1", "ctxRecon" : "T$A=1@O=Malmö Centralstation@L=740000003@a=128@$A=1@O=Hässleholm Centralstation@L=740000006@a=128@$201907051131$201907051229$JLT 1415$$1$", "LegList" : { "Leg" : [ { "transportCategory" : "JLT", "reachable" : true, "transportNumber" : "1415", "Stops" : { "Stop" : [ { "depTime" : "11:31:00", "name" : "Malmö Centralstation", "id" : "740000003", "lat" : 55.609456000000002, "lon" : 13.000909999999999, "routeIdx" : 7, "depDate" : "2019-07-05", "extId" : "740000003" }, { "depTime" : "11:44:00", "depDate" : "2019-07-05", "arrTime" : "11:42:00", "name" : "Lund Centralstation", "id" : "740000120", "lat" : 55.708094000000003, "lon" : 13.186897, "routeIdx" : 8, "arrDate" : "2019-07-05", "extId" : "740000120" }, { "depTime" : "11:49:00", "depDate" : "2019-07-05", "arrTime" : "11:49:00", "name" : "Stångby station (Lund kn)", "id" : "740000834", "lat" : 55.751153000000002, "lon" : 13.200201, "routeIdx" : 9, "arrDate" : "2019-07-05", "extId" : "740000834" }, { "depTime" : "11:53:00", "depDate" : "2019-07-05", "arrTime" : "11:53:00", "name" : "Örtofta station (Eslöv kn)", "id" : "740000961", "lat" : 55.778928999999998, "lon" : 13.243969, "routeIdx" : 10, "arrDate" : "2019-07-05", "extId" : "740000961" }, { "depTime" : "11:59:00", "depDate" : "2019-07-05", "arrTime" : "11:58:00", "name" : "Eslöv station", "id" : "740000260", "lat" : 55.837719, "lon" : 13.305491, "routeIdx" : 11, "arrDate" : "2019-07-05", "extId" : "740000260" }, { "depTime" : "12:05:00", "depDate" : "2019-07-05", "arrTime" : "12:05:00", "name" : "Stehag station (Eslöv kn)", "id" : "740000952", "lat" : 55.900813999999997, "lon" : 13.394852999999999, "routeIdx" : 12, "arrDate" : "2019-07-05", "extId" : "740000952" }, { "depTime" : "12:11:00", "depDate" : "2019-07-05", "arrTime" : "12:10:00", "name" : "Höör station", "id" : "740000185", "lat" : 55.937023000000003, "lon" : 13.541395, "routeIdx" : 13, "arrDate" : "2019-07-05", "extId" : "740000185" }, { "depTime" : "12:17:00", "depDate" : "2019-07-05", "arrTime" : "12:17:00", "name" : "Tjörnarp station (Höör kn)", "id" : "740001611", "lat" : 56.000315999999998, "lon" : 13.629849, "routeIdx" : 14, "arrDate" : "2019-07-05", "extId" : "740001611" }, { "depTime" : "12:21:00", "depDate" : "2019-07-05", "arrTime" : "12:21:00", "name" : "Sösdala station (Hässleholm kn)", "id" : "740001334", "lat" : 56.036271999999997, "lon" : 13.680422, "routeIdx" : 15, "arrDate" : "2019-07-05", "extId" : "740001334" }, { "name" : "Hässleholm Centralstation", "arrTime" : "12:29:00", "id" : "740000006", "lat" : 56.157761999999998, "lon" : 13.763140999999999, "routeIdx" : 16, "arrDate" : "2019-07-05", "extId" : "740000006" } ] }, "Origin" : { "name" : "Malmö Centralstation", "date" : "2019-07-05", "type" : "ST", "id" : "740000003", "lat" : 55.609456000000002, "lon" : 13.000909999999999, "routeIdx" : 7, "extId" : "740000003", "time" : "11:31:00" }, "Notes" : { "Note" : [ { "key" : "VG", "routeIdxFrom" : 7, "type" : "A", "priority" : 100, "routeIdxTo" : 16, "value" : "Pågatågen" }, { "key" : "AA", "routeIdxFrom" : 7, "type" : "A", "priority" : 100, "routeIdxTo" : 16, "value" : "Endast 2 klass" }, { "key" : "AE", "routeIdxFrom" : 7, "type" : "A", "priority" : 100, "routeIdxTo" : 16, "value" : "Ej reservering" } ] }, "direction" : "Kristianstad Centralstation", "Destination" : { "lon" : 13.763140999999999, "type" : "ST", "time" : "12:29:00", "name" : "Hässleholm Centralstation", "date" : "2019-07-05", "id" : "740000006", "lat" : 56.157761999999998, "extId" : "740000006", "routeIdx" : 16 }, "idx" : "0", "name" : "Länstrafik - Tåg 1415", "Product" : { "operatorCode" : "276", "catOutL" : "Länstrafik - Tåg", "name" : "Länstrafik - Tåg 1415", "operator" : "Skånetrafiken", "catOutS" : "JLT", "catCode" : "4", "num" : "1415", "operatorUrl" : "http:\/\/www.skanetrafiken.se" }, "type" : "JNY" } ] }, "ServiceDays" : [ { "sDaysB" : "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE", "planningPeriodBegin" : "2019-07-01", "planningPeriodEnd" : "2019-12-14", "sDaysR" : "daily" } ], "idx" : 1 }, { "duration" : "PT58M", "tripId" : "C-2", "ctxRecon" : "T$A=1@O=Malmö Centralstation@L=740000003@a=128@$A=1@O=Hässleholm Centralstation@L=740000006@a=128@$201907051231$201907051329$JLT 1417$$1$", "LegList" : { "Leg" : [ { "Destination" : { "date" : "2019-07-05", "lon" : 13.763140999999999, "routeIdx" : 16, "time" : "13:29:00", "lat" : 56.157761999999998, "name" : "Hässleholm Centralstation", "type" : "ST", "id" : "740000006", "extId" : "740000006" }, "transportCategory" : "JLT", "transportNumber" : "1417", "direction" : "Kristianstad Centralstation", "idx" : "0", "Notes" : { "Note" : [ { "routeIdxFrom" : 7, "routeIdxTo" : 16, "priority" : 100, "type" : "A", "value" : "Pågatågen", "key" : "VG" }, { "routeIdxFrom" : 7, "routeIdxTo" : 16, "priority" : 100, "type" : "A", "value" : "Endast 2 klass", "key" : "AA" }, { "routeIdxFrom" : 7, "routeIdxTo" : 16, "priority" : 100, "type" : "A", "value" : "Ej reservering", "key" : "AE" } ] }, "name" : "Länstrafik - Tåg 1417", "Product" : { "catOutS" : "JLT", "num" : "1417", "operatorCode" : "276", "operator" : "Skånetrafiken", "catOutL" : "Länstrafik - Tåg", "catCode" : "4", "operatorUrl" : "http:\/\/www.skanetrafiken.se", "name" : "Länstrafik - Tåg 1417" }, "Origin" : { "lon" : 13.000909999999999, "name" : "Malmö Centralstation", "extId" : "740000003", "time" : "12:31:00", "routeIdx" : 7, "type" : "ST", "lat" : 55.609456000000002, "id" : "740000003", "date" : "2019-07-05" }, "Stops" : { "Stop" : [ { "lon" : 13.000909999999999, "extId" : "740000003", "routeIdx" : 7, "lat" : 55.609456000000002, "depTime" : "12:31:00", "id" : "740000003", "depDate" : "2019-07-05", "name" : "Malmö Centralstation" }, { "lon" : 13.186897, "arrDate" : "2019-07-05", "arrTime" : "12:42:00", "extId" : "740000120", "routeIdx" : 8, "lat" : 55.708094000000003, "id" : "740000120", "depTime" : "12:44:00", "depDate" : "2019-07-05", "name" : "Lund Centralstation" }, { "lon" : 13.200201, "arrDate" : "2019-07-05", "arrTime" : "12:49:00", "extId" : "740000834", "routeIdx" : 9, "lat" : 55.751153000000002, "id" : "740000834", "depTime" : "12:49:00", "depDate" : "2019-07-05", "name" : "Stångby station (Lund kn)" }, { "lon" : 13.243969, "arrDate" : "2019-07-05", "arrTime" : "12:53:00", "extId" : "740000961", "routeIdx" : 10, "lat" : 55.778928999999998, "id" : "740000961", "depTime" : "12:53:00", "depDate" : "2019-07-05", "name" : "Örtofta station (Eslöv kn)" }, { "lon" : 13.305491, "arrDate" : "2019-07-05", "arrTime" : "12:58:00", "extId" : "740000260", "routeIdx" : 11, "lat" : 55.837719, "id" : "740000260", "depTime" : "12:59:00", "depDate" : "2019-07-05", "name" : "Eslöv station" }, { "lon" : 13.394852999999999, "arrDate" : "2019-07-05", "arrTime" : "13:05:00", "extId" : "740000952", "routeIdx" : 12, "lat" : 55.900813999999997, "id" : "740000952", "depTime" : "13:05:00", "depDate" : "2019-07-05", "name" : "Stehag station (Eslöv kn)" }, { "lon" : 13.541395, "arrDate" : "2019-07-05", "arrTime" : "13:10:00", "extId" : "740000185", "routeIdx" : 13, "lat" : 55.937023000000003, "id" : "740000185", "depTime" : "13:11:00", "depDate" : "2019-07-05", "name" : "Höör station" }, { "lon" : 13.629849, "arrDate" : "2019-07-05", "arrTime" : "13:17:00", "extId" : "740001611", "routeIdx" : 14, "lat" : 56.000315999999998, "id" : "740001611", "depTime" : "13:17:00", "depDate" : "2019-07-05", "name" : "Tjörnarp station (Höör kn)" }, { "lon" : 13.680422, "arrDate" : "2019-07-05", "arrTime" : "13:21:00", "extId" : "740001334", "routeIdx" : 15, "lat" : 56.036271999999997, "id" : "740001334", "depTime" : "13:21:00", "depDate" : "2019-07-05", "name" : "Sösdala station (Hässleholm kn)" }, { "lon" : 13.763140999999999, "arrDate" : "2019-07-05", "arrTime" : "13:29:00", "extId" : "740000006", "routeIdx" : 16, "lat" : 56.157761999999998, "id" : "740000006", "name" : "Hässleholm Centralstation" } ] }, "type" : "JNY", "reachable" : true } ] }, "ServiceDays" : [ { "sDaysR" : "daily", "planningPeriodEnd" : "2019-12-14", "planningPeriodBegin" : "2019-07-01", "sDaysB" : "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE" } ], "idx" : 2 }, { "duration" : "PT58M", "tripId" : "C-3", "ctxRecon" : "T$A=1@O=Malmö Centralstation@L=740000003@a=128@$A=1@O=Hässleholm Centralstation@L=740000006@a=128@$201907051331$201907051429$JLT 1419$$1$", "LegList" : { "Leg" : [ { "Stops" : { "Stop" : [ { "extId" : "740000003", "id" : "740000003", "lon" : 13.000909999999999, "depDate" : "2019-07-05", "depTime" : "13:31:00", "lat" : 55.609456000000002, "name" : "Malmö Centralstation", "routeIdx" : 7 }, { "depDate" : "2019-07-05", "name" : "Lund Centralstation", "depTime" : "13:45:00", "arrTime" : "13:42:00", "lat" : 55.708094000000003, "lon" : 13.186897, "arrDate" : "2019-07-05", "id" : "740000120", "routeIdx" : 8, "extId" : "740000120" }, { "id" : "740000834", "name" : "Stångby station (Lund kn)", "arrTime" : "13:50:00", "extId" : "740000834", "lon" : 13.200201, "lat" : 55.751153000000002, "depTime" : "13:50:00", "arrDate" : "2019-07-05", "depDate" : "2019-07-05", "routeIdx" : 9 }, { "lon" : 13.243969, "depTime" : "13:54:00", "arrDate" : "2019-07-05", "name" : "Örtofta station (Eslöv kn)", "lat" : 55.778928999999998, "id" : "740000961", "extId" : "740000961", "arrTime" : "13:54:00", "routeIdx" : 10, "depDate" : "2019-07-05" }, { "depDate" : "2019-07-05", "name" : "Eslöv station", "arrDate" : "2019-07-05", "lat" : 55.837719, "depTime" : "13:59:00", "lon" : 13.305491, "id" : "740000260", "extId" : "740000260", "routeIdx" : 11, "arrTime" : "13:59:00" }, { "name" : "Stehag station (Eslöv kn)", "extId" : "740000952", "arrDate" : "2019-07-05", "depTime" : "14:05:00", "arrTime" : "14:05:00", "routeIdx" : 12, "lon" : 13.394852999999999, "depDate" : "2019-07-05", "lat" : 55.900813999999997, "id" : "740000952" }, { "id" : "740000185", "arrTime" : "14:11:00", "lat" : 55.937023000000003, "depTime" : "14:11:00", "extId" : "740000185", "lon" : 13.541395, "name" : "Höör station", "routeIdx" : 13, "depDate" : "2019-07-05", "arrDate" : "2019-07-05" }, { "depTime" : "14:17:00", "depDate" : "2019-07-05", "name" : "Tjörnarp station (Höör kn)", "extId" : "740001611", "lon" : 13.629849, "arrDate" : "2019-07-05", "id" : "740001611", "lat" : 56.000315999999998, "arrTime" : "14:17:00", "routeIdx" : 14 }, { "lat" : 56.036271999999997, "extId" : "740001334", "id" : "740001334", "depDate" : "2019-07-05", "name" : "Sösdala station (Hässleholm kn)", "lon" : 13.680422, "routeIdx" : 15, "arrTime" : "14:21:00", "arrDate" : "2019-07-05", "depTime" : "14:21:00" }, { "name" : "Hässleholm Centralstation", "extId" : "740000006", "id" : "740000006", "lon" : 13.763140999999999, "arrDate" : "2019-07-05", "lat" : 56.157761999999998, "arrTime" : "14:29:00", "routeIdx" : 16 } ] }, "Notes" : { "Note" : [ { "routeIdxFrom" : 7, "priority" : 100, "value" : "Pågatågen", "key" : "VG", "type" : "A", "routeIdxTo" : 16 }, { "routeIdxFrom" : 7, "priority" : 100, "value" : "Endast 2 klass", "key" : "AA", "type" : "A", "routeIdxTo" : 16 }, { "routeIdxFrom" : 7, "priority" : 100, "value" : "Ej reservering", "key" : "AE", "type" : "A", "routeIdxTo" : 16 } ] }, "Origin" : { "lon" : 13.000909999999999, "id" : "740000003", "lat" : 55.609456000000002, "time" : "13:31:00", "name" : "Malmö Centralstation", "routeIdx" : 7, "date" : "2019-07-05", "type" : "ST", "extId" : "740000003" }, "transportNumber" : "1419", "type" : "JNY", "reachable" : true, "name" : "Länstrafik - Tåg 1419", "Product" : { "catOutL" : "Länstrafik - Tåg", "name" : "Länstrafik - Tåg 1419", "catCode" : "4", "operatorUrl" : "http:\/\/www.skanetrafiken.se", "operatorCode" : "276", "num" : "1419", "catOutS" : "JLT", "operator" : "Skånetrafiken" }, "Destination" : { "lon" : 13.763140999999999, "id" : "740000006", "lat" : 56.157761999999998, "time" : "14:29:00", "name" : "Hässleholm Centralstation", "routeIdx" : 16, "date" : "2019-07-05", "type" : "ST", "extId" : "740000006" }, "idx" : "0", "direction" : "Kristianstad Centralstation", "transportCategory" : "JLT" } ] }, "ServiceDays" : [ { "sDaysB" : "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE", "planningPeriodBegin" : "2019-07-01", "planningPeriodEnd" : "2019-12-14", "sDaysR" : "daily" } ], "idx" : 3 }, { "duration" : "PT58M", "tripId" : "C-4", "ctxRecon" : "T$A=1@O=Malmö Centralstation@L=740000003@a=128@$A=1@O=Hässleholm Centralstation@L=740000006@a=128@$201907051431$201907051529$JLT 1421$$1$", "LegList" : { "Leg" : [ { "reachable" : true, "transportCategory" : "JLT", "name" : "Länstrafik - Tåg 1421", "Notes" : { "Note" : [ { "value" : "Pågatågen", "key" : "VG", "priority" : 100, "routeIdxTo" : 16, "type" : "A", "routeIdxFrom" : 7 }, { "value" : "Endast 2 klass", "key" : "AA", "priority" : 100, "routeIdxTo" : 16, "type" : "A", "routeIdxFrom" : 7 }, { "value" : "Ej reservering", "key" : "AE", "priority" : 100, "routeIdxTo" : 16, "type" : "A", "routeIdxFrom" : 7 } ] }, "Origin" : { "lat" : 55.609456000000002, "name" : "Malmö Centralstation", "time" : "14:31:00", "routeIdx" : 7, "type" : "ST", "extId" : "740000003", "lon" : 13.000909999999999, "id" : "740000003", "date" : "2019-07-05" }, "Stops" : { "Stop" : [ { "lat" : 55.609456000000002, "name" : "Malmö Centralstation", "routeIdx" : 7, "extId" : "740000003", "depTime" : "14:31:00", "id" : "740000003", "lon" : 13.000909999999999, "depDate" : "2019-07-05" }, { "lat" : 55.708094000000003, "name" : "Lund Centralstation", "routeIdx" : 8, "extId" : "740000120", "depTime" : "14:44:00", "id" : "740000120", "arrDate" : "2019-07-05", "lon" : 13.186897, "depDate" : "2019-07-05", "arrTime" : "14:42:00" }, { "lat" : 55.751153000000002, "name" : "Stångby station (Lund kn)", "routeIdx" : 9, "extId" : "740000834", "depTime" : "14:49:00", "id" : "740000834", "arrDate" : "2019-07-05", "lon" : 13.200201, "depDate" : "2019-07-05", "arrTime" : "14:49:00" }, { "lat" : 55.778928999999998, "name" : "Örtofta station (Eslöv kn)", "routeIdx" : 10, "extId" : "740000961", "depTime" : "14:53:00", "id" : "740000961", "arrDate" : "2019-07-05", "lon" : 13.243969, "depDate" : "2019-07-05", "arrTime" : "14:53:00" }, { "lat" : 55.837719, "name" : "Eslöv station", "routeIdx" : 11, "extId" : "740000260", "depTime" : "14:59:00", "id" : "740000260", "arrDate" : "2019-07-05", "lon" : 13.305491, "depDate" : "2019-07-05", "arrTime" : "14:58:00" }, { "lat" : 55.900813999999997, "name" : "Stehag station (Eslöv kn)", "routeIdx" : 12, "extId" : "740000952", "depTime" : "15:05:00", "id" : "740000952", "arrDate" : "2019-07-05", "lon" : 13.394852999999999, "depDate" : "2019-07-05", "arrTime" : "15:05:00" }, { "lat" : 55.937023000000003, "name" : "Höör station", "routeIdx" : 13, "extId" : "740000185", "depTime" : "15:11:00", "id" : "740000185", "arrDate" : "2019-07-05", "lon" : 13.541395, "depDate" : "2019-07-05", "arrTime" : "15:10:00" }, { "lat" : 56.000315999999998, "name" : "Tjörnarp station (Höör kn)", "routeIdx" : 14, "extId" : "740001611", "depTime" : "15:17:00", "id" : "740001611", "arrDate" : "2019-07-05", "lon" : 13.629849, "depDate" : "2019-07-05", "arrTime" : "15:17:00" }, { "lat" : 56.036271999999997, "name" : "Sösdala station (Hässleholm kn)", "routeIdx" : 15, "extId" : "740001334", "depTime" : "15:21:00", "id" : "740001334", "arrDate" : "2019-07-05", "lon" : 13.680422, "depDate" : "2019-07-05", "arrTime" : "15:21:00" }, { "lat" : 56.157761999999998, "name" : "Hässleholm Centralstation", "routeIdx" : 16, "extId" : "740000006", "arrDate" : "2019-07-05", "id" : "740000006", "lon" : 13.763140999999999, "arrTime" : "15:29:00" } ] }, "Product" : { "num" : "1421", "name" : "Länstrafik - Tåg 1421", "operator" : "Skånetrafiken", "catCode" : "4", "catOutL" : "Länstrafik - Tåg", "operatorUrl" : "http:\/\/www.skanetrafiken.se", "operatorCode" : "276", "catOutS" : "JLT" }, "transportNumber" : "1421", "Destination" : { "lat" : 56.157761999999998, "name" : "Hässleholm Centralstation", "time" : "15:29:00", "routeIdx" : 16, "type" : "ST", "extId" : "740000006", "lon" : 13.763140999999999, "id" : "740000006", "date" : "2019-07-05" }, "type" : "JNY", "direction" : "Kristianstad Centralstation", "idx" : "0" } ] }, "ServiceDays" : [ { "planningPeriodEnd" : "2019-12-14", "planningPeriodBegin" : "2019-07-01", "sDaysB" : "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE", "sDaysR" : "daily" } ], "idx" : 4 }, { "duration" : "PT58M", "tripId" : "C-5", "ctxRecon" : "T$A=1@O=Malmö Centralstation@L=740000003@a=128@$A=1@O=Hässleholm Centralstation@L=740000006@a=128@$201907051531$201907051629$JLT 1423$$1$", "LegList" : { "Leg" : [ { "Stops" : { "Stop" : [ { "name" : "Malmö Centralstation", "routeIdx" : 7, "depDate" : "2019-07-05", "lon" : 13.000909999999999, "id" : "740000003", "lat" : 55.609456000000002, "extId" : "740000003", "depTime" : "15:31:00" }, { "depDate" : "2019-07-05", "arrDate" : "2019-07-05", "id" : "740000120", "routeIdx" : 8, "depTime" : "15:44:00", "lat" : 55.708094000000003, "lon" : 13.186897, "arrTime" : "15:42:00", "name" : "Lund Centralstation", "extId" : "740000120" }, { "arrTime" : "15:49:00", "lon" : 13.200201, "depDate" : "2019-07-05", "lat" : 55.751153000000002, "name" : "Stångby station (Lund kn)", "routeIdx" : 9, "arrDate" : "2019-07-05", "id" : "740000834", "depTime" : "15:49:00", "extId" : "740000834" }, { "lon" : 13.243969, "lat" : 55.778928999999998, "name" : "Örtofta station (Eslöv kn)", "depTime" : "15:53:00", "arrDate" : "2019-07-05", "arrTime" : "15:53:00", "depDate" : "2019-07-05", "extId" : "740000961", "id" : "740000961", "routeIdx" : 10 }, { "depTime" : "15:59:00", "depDate" : "2019-07-05", "routeIdx" : 11, "arrTime" : "15:58:00", "lat" : 55.837719, "extId" : "740000260", "id" : "740000260", "arrDate" : "2019-07-05", "lon" : 13.305491, "name" : "Eslöv station" }, { "depTime" : "16:05:00", "depDate" : "2019-07-05", "id" : "740000952", "routeIdx" : 12, "arrTime" : "16:05:00", "arrDate" : "2019-07-05", "extId" : "740000952", "lat" : 55.900813999999997, "name" : "Stehag station (Eslöv kn)", "lon" : 13.394852999999999 }, { "extId" : "740000185", "arrTime" : "16:10:00", "depDate" : "2019-07-05", "name" : "Höör station", "routeIdx" : 13, "id" : "740000185", "lon" : 13.541395, "lat" : 55.937023000000003, "arrDate" : "2019-07-05", "depTime" : "16:11:00" }, { "depTime" : "16:17:00", "id" : "740001611", "lat" : 56.000315999999998, "name" : "Tjörnarp station (Höör kn)", "extId" : "740001611", "lon" : 13.629849, "depDate" : "2019-07-05", "arrTime" : "16:17:00", "routeIdx" : 14, "arrDate" : "2019-07-05" }, { "arrDate" : "2019-07-05", "lon" : 13.680422, "routeIdx" : 15, "depDate" : "2019-07-05", "lat" : 56.036271999999997, "name" : "Sösdala station (Hässleholm kn)", "arrTime" : "16:21:00", "id" : "740001334", "depTime" : "16:21:00", "extId" : "740001334" }, { "routeIdx" : 16, "lon" : 13.763140999999999, "arrTime" : "16:29:00", "arrDate" : "2019-07-05", "lat" : 56.157761999999998, "name" : "Hässleholm Centralstation", "extId" : "740000006", "id" : "740000006" } ] }, "idx" : "0", "reachable" : true, "Destination" : { "lat" : 56.157761999999998, "name" : "Hässleholm Centralstation", "lon" : 13.763140999999999, "routeIdx" : 16, "extId" : "740000006", "time" : "16:29:00", "id" : "740000006", "type" : "ST", "date" : "2019-07-05" }, "transportCategory" : "JLT", "Product" : { "num" : "1423", "operator" : "Skånetrafiken", "catCode" : "4", "catOutL" : "Länstrafik - Tåg", "name" : "Länstrafik - Tåg 1423", "operatorUrl" : "http:\/\/www.skanetrafiken.se", "catOutS" : "JLT", "operatorCode" : "276" }, "transportNumber" : "1423", "type" : "JNY", "name" : "Länstrafik - Tåg 1423", "Origin" : { "lat" : 55.609456000000002, "name" : "Malmö Centralstation", "lon" : 13.000909999999999, "routeIdx" : 7, "extId" : "740000003", "time" : "15:31:00", "id" : "740000003", "type" : "ST", "date" : "2019-07-05" }, "Notes" : { "Note" : [ { "type" : "A", "routeIdxTo" : 16, "priority" : 100, "key" : "VG", "routeIdxFrom" : 7, "value" : "Pågatågen" }, { "type" : "A", "routeIdxTo" : 16, "priority" : 100, "key" : "AA", "routeIdxFrom" : 7, "value" : "Endast 2 klass" }, { "type" : "A", "routeIdxTo" : 16, "priority" : 100, "key" : "AE", "routeIdxFrom" : 7, "value" : "Ej reservering" } ] }, "direction" : "Kristianstad Centralstation" } ] }, "ServiceDays" : [ { "sDaysB" : "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE", "planningPeriodBegin" : "2019-07-01", "planningPeriodEnd" : "2019-12-14", "sDaysR" : "daily" } ], "idx" : 5 } ], "scrB" : "1|OB|MTµ11µ9271µ9271µ9329µ9329µ0µ0µ365µ9267µ1µ-2147482382µ0µ1µ2|PDHµbd033c9dee1b176b90acb08de9f0f7fb|RDµ5072019|RTµ102711", "scrF" : "1|OF|MTµ11µ9571µ9571µ9629µ9629µ0µ0µ365µ9512µ6µ-2147482382µ0µ1µ2|PDHµbd033c9dee1b176b90acb08de9f0f7fb|RDµ5072019|RTµ102711" }
Posted
by net777.
Last updated
.
Post marked as solved
32 Replies
3k Views
I am following a course and am trying so test myself.I have a model and I give values to properties from a json-file.(If Im showing code wrong please tell me how I shoud do it)This works:func updateUIWithWeatherData() { cityLabel.text = weatherDataModel.city temperatureLabel.text = String(weatherDataModel.temperature) weatherIcon.image = UIImage(named: weatherDataModel.weatherIconName) }But here it doesn't. Test shows but not the city.func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = UITableViewCell(style: .default, reuseIdentifier: "Cell") cell.textLabel?.text = weatherDataModel.city //cell.textLabel?.text = "test" return cell }
Posted
by net777.
Last updated
.