How to convert a String to a Double in Swift?
Hello everyone! I just started learning Swift and encountered a problem when working with numbers. I have a text field where the user enters the price of a product, and I need to convert this string to Double for further calculations.\n\nHere is my code:\n\n```swift\nlet priceString = "12.50"\nlet priceDouble = Double(priceString) // An error occurs here\n```\n\nI read that you can use `Double()`, but I get `nil` or a compilation error. I tried different options, but nothing works. Please tell me how to correctly convert a string to Double? What should I do if the string contains not only digits but also letters? For example, the user might enter "12,50" instead of "12.50" (with a comma instead of a dot). How to handle such cases?\n\nI would be grateful for code examples and an explanation of how to avoid