0
votes
import SwiftUI

let myPink = Color(red: 250/255, green: 114/255, blue: 100/255)
public let myHeadline = Font.custom("Lobster-Regular", size: 40,relativeTo: .title)

Created a custom font here⬆️

struct ContentView: View {
    
    @State  var UserName:String="Eric He"
    var body: some View {
        ZStack{
        Rectangle() 
                .foregroundColor(myPink)
                .ignoresSafeArea()
        VStack{
            Spacer().frame(height:70)
            HStack{
                Text("Hi,")
                    .font(myHeadline)

here I used my own font⬆️

                    .foregroundColor(myWhite)
                
            }
        Spacer()
        Navigator()
        }.ignoresSafeArea()
        
        
    }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
         
    }
}

It looks like this

I'm a newcomer to coding, I will appreciate a lot if you could help me!????

1

1 Answers

0
votes

I believe you have to add the font to your project.

In Xcode, select the Project navigator.

  1. Drag your fonts from a Finder window into your project. This copies the > 2. fonts to your project.
  2. Select the font or folder with the fonts, and verify that the files show their target membership checked for your app’s targets.

- Apple

Apple also provides documentation listing fonts that are installed by default.