If you’d like to interpolate a float or a double with a String in Swift, use the %f String format specifier with appropriate number in order to specify floating point precision. Given a Float or a Double value: var value = 4.53978 Create a string with value rounded to one decimal place which results in …
Month: December 2019
How to add text overlay on image in SwiftUI
Learn how to add text overlay on top of an image in SwiftUI. Achieve it by using the .overlay() modifier which layers a second view in front of other view. First of all, import an image into your Xcode project. I won’t go into details how to achieve it but if you’d like to learn, …
SwiftUI Image tutorial
Learn how to use Images in SwiftUI, resize images, adjust their content ratio, style them and more. This tutorial will get you started with SwiftUI Images. In the following examples we are going to use a photo downloaded from Unsplash. In order to add it to your Xcode project, download it to your computer, click …