编辑代码

var myString = "Hello world!     -  swift.jsrun.net"
print(myString)
Text("www.baidu.com")
            .background(Color.red)
            .foregroundColor(.white)
            .padding()

            Text("www.baidu.com")
                .padding(20)
            .background(Color.black)
            .foregroundColor(.white)



            Text("www.baidu.com")
            .padding()
            .background(Color.black)
            .foregroundColor(.white)

            Text("www.baidu.com")
                .padding(4)
            .background(Color.black)
            .foregroundColor(.white)


            Text("Swift UI Doing")
            .font(.largeTitle)
            .foregroundColor(.black)
            .padding(15)
            .background(Color.yellow)
            .padding(15)
            .background(Color.orange)
            .padding(20)
            .background(Color.red)
            Text("橙色大背景")
                .frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity,alignment: .leading)
                
                    .background(Color.orange)
           
                    .font(.largeTitle)
                
                    .edgesIgnoringSafeArea(.all)
                    Text("现在时间是: \(xianzai, formatter: Self.dataFormatter)")
                            .font(.title)
                            .padding()
                            .background(Color.green)

var xianzai = Date()
    static let dataFormatter :DateFormatter = {
        let formatter = DateFormatter()
        formatter.dateStyle = .long
        return formatter
        
    }()
    //            添加扩展方法+,对文本View进行拼接,实现富文本的效果。
                        Text("文本一 ")
                            .foregroundColor(.yellow)
                            .fontWeight(.heavy)
                        + Text("文本二 ")
                            .foregroundColor(.blue)
                            .strikethrough()
                        + Text("文本三 ")
                            .foregroundColor(.red)
                            .italic()
                        + Text("文本四")
                            .foregroundColor(.green)
                            .underline()