NEW: My new book Pro SwiftUI is out now – level up your SwiftUI skills today! >>

SOLVED: Vertical text

Forums > SwiftUI

i want to display a text string where the text is vertical rather than horizontal, is there a way to do this?

   

@Bnerd  

Something like this?

 Text("Hello MrGLWatson").rotationEffect(Angle(degrees: 90))

Or like this

var string = "Hello MrGLWatson"
    @State private var stringArray = [String]()

    var body: some View {
        VStack {
            ForEach(stringArray, id: \.self) { i in
                Text("\(i)\n")
            }
        }.onAppear {
            for i in string {
                stringArray.append(String(i))
            }
        }
    }

\n , simulates the return.

1      

Hacking with Swift is sponsored by Play

SPONSORED Play is the first native iOS design tool created for designers and engineers. You can install Play for iOS and iPad today and sign up to check out the Beta of our macOS app with SwiftUI code export. We're also hiring engineers!

Click to learn more about Play!

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.