How to align single line text in SwiftUI

DevTechie
DevTechie
Published in
3 min readSep 1, 2022

--

SwiftUI’s Text view provides alignment modifier with multilineTextAlignment but it only works for the view which has multiple lines of text. So in this article, we will explore a way to align text for single line string in Text view.

Let’s start coding. We will put together a simple view with Text view.

struct DevTechieTextAlignment: View {
var body: some View {…

--

--