if let place = placement?[0] {
if place.postalCode != nil {
self.currentLocation.text = "Current Location: \(place.postalCode!)"
self.currentPostalCode = Int(place.postalCode!)
if (district1ZipCodes.contains(self.currentPostalCode) != false) {
self.congressionalDistrict.text = "Congressional District: 1st"
representatives.insert(String("Steve Chabot(R)"), at: 0)
}
if (district2ZipCodes.contains(self.currentPostalCode) != false) {
self.congressionalDistrict.text = "Congressional District: 2nd"
representatives.insert(String("Brad Wenstrup(R)"), at: 0)
}
if (district3ZipCodes.contains(self.currentPostalCode) != false) {
self.congressionalDistrict.text = "Congressional District: 3rd"
representatives.insert(String("Joyce Beatty(D)"), at: 0)
}
if (district3ZipCodes.contains(self.currentPostalCode) != false) {
self.congressionalDistrict.text = "Congressional District: 4th"
representatives.insert(String("Jim Jordan(R)"), at: 0)
}
if (district5ZipCodes.contains(self.currentPostalCode) != false) {
self.congressionalDistrict.text = "Congressional District: 5th"
representatives.insert(String("Robert Latta(R)"), at: 0)
}
if (district14ZipCodes.contains(self.currentPostalCode) != false) {
self.congressionalDistrict.text = "Congressional District: 14th"
representatives.insert(String("David Joyce(R)"), at: 0)
}
}
}
So in my code, I have an app that's running this are of code to assign a label to a table, but for some reason, it does this over and over again as if it were a loop but it's an if statement. Please help me out:)
Aucun commentaire:
Enregistrer un commentaire