me icon indicating copy to clipboard operation
me copied to clipboard

学习 MacOS 开发 (Part 8: SwiftUI)

Open nonocast opened this issue 2 years ago • 0 comments

快捷键

  • Build: command+B
  • Clean: command+shift+K
  • Format: command+A, ctrl+I
  • Library: command+shift+L

第一个SwiftUI布局

import SwiftUI

struct ContentView: View {
    var body: some View {
        VStack(alignment: .leading, spacing: 8.0) {
            Spacer()
            Image("Logo 2")
                .resizable(resizingMode: .stretch)
                .aspectRatio(contentMode: .fit)
                .frame(width: 26.0, height: 26.0)
                .cornerRadius(20.0)
            Text("SwiftUI for iOS 15")
                .font(.largeTitle)
                .fontWeight(.bold)
            Text("20 sections - 3 hours")
                .font(.footnote)
                .fontWeight(.semibold)
            Text("Build an iOS app for iOS 15 with custom layouts, animations and ...")
                .font(.footnote)
                .multilineTextAlignment(.leading)
                .lineLimit(2)
        }
        .padding(.all, 20.0)
        .frame(height: 350.0)
        .background(Color("Background"))
        .cornerRadius(20.0)
        .shadow(radius: 20)
    }
}

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

学习SwiftUI,或者说Xcode系,最最重要的是,就是要通过视频去学习,Build a SwiftUI app for iOS 15 - Design+Code

nonocast avatar Apr 30 '22 03:04 nonocast