You created your account the same day you asked this question. So, Welcome to Hacking With Swift forums!
In the header of each page in HackingWithSwift is a search bar. Did you search for "picker" using the search bar? @twostraws has several articles and videos where he explains (using great examples!) how to construct and use pickers. Let us know which articles helped you, or which parts need more clarification.
This may not be a SwiftUI problem. But we're glad to help you think through this problem.
Ask yourself, "Self? What do I want my user to see in the picker?"
You answered "City Names".
Then ask yourself, "What do I need when the user selects a city from the picker?"
You answered: "Latitude and Longitude"
Now you need to think about your model. HOW will you model this so that you have data to show your users and also have data to use in your application?
You should think along the lines of, "What Swift programming structure can help me organize a bunch of similar data?" Well the answer will soon be very familiar to you. It's a structure!
struct City: Identifiable {
let id = UUID() // useful for common SwiftUI display
let city: String // Toronto, Naples, Berlin, etc.
let latitude: String // What's the best format to
let longitude: String // store latitude and longitude?
let description: String // maybe a few sentences?
}
You'll need to create a structure for each city in your application. Perhaps you get the data from an internet source? Or it might be a file in your application?
You'll use the structure's name property to display in the picker list.
When the user selects from the picker, they are selecting a structure, not a text field.
Then you can unpack the latitude and longitude from the structure and use the data elsewhere in your application.
Watch a few of @twostraw's videos on structures and pickers. Let us know which ones helped, or which ones confused you.