赞
踩
到目前为止, 你应该对xcode工具和swift语言有所了解,如果你没看过前面2节, 建议先看看,这章,会深入了解一下SwiftUI 框架特性
File->New->Project选择iOS–>App
下一步, 工程名,命名为 HelloWorld
其中organization identifier可以填写比较个性的定义,或者如果有你网站,可以填写网站域名,然后点Next, xcode会提示你保存Project, 然后就会看到下面界面
import SwiftUI struct ContentView: View { var body: some View { Text("Hello, world!") .fontWeight(.bold) .font(.system(.title, design: .rounded)) .frame(width: 200, height: 50, alignment: .center) .background(.yellow) .foregroundColor(.indigo) .cornerRadius(20) } } struct ContentView_Previews: PreviewProvider { static var previews: some View { Group { ContentView() .previewDevice(PreviewDevice(rawValue: "iPhone 12 mini")) .previewDisplayName("iPhone 12 mini-暗色") .preferredColorScheme(.dark) ContentView() .
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。