Learn how to create and use Buttons in SwiftUI. Style the button with text and images, add border around it. Perform actions when button is pressed and update SwiftUI view accordingly. SwiftUI Button is similar to UIButton from UIKit when it comes to behavior however you define it in a different way by specifying an …
Month: January 2020
How to use SF Symbols in SwiftUI
While this tutorial mostly focuses on using SF Symbols in SwiftUI, there is a section at the end which covers how to use SF Symbols in UIKit. What are SF Symbols? I think Apple’s documentation explains it best: SF Symbols provides a set of over 1,500 consistent, highly configurable symbols you can use in your …
How to convert String to Double or Float in Swift
Converting a String to a Double or Float can be easily achieved by using the if let statement in Swift. Take a look at the following example: var string = “12.2416” if let floatValue = Float(string) { print(“Float value = \(floatValue)”) } else { print(“String does not contain Float”) } If the String contains a valid …