实战需求
macOS SwiftUI 经典框架之上下瀑布式工具栏框架
本文价值与收获
看完本文后,您将能够作出下面的界面
看完本文您将掌握的技能
- 垂直布局 ZStack(alignment: Alignment(horizontal: .center, vertical: .bottom))
- 垂直间隔.padding(.vertical)
- 设置阴影体现组件分割 .shadow(color: Color.black.opacity(0.08), radius: 5, x: 0, y: 5)
- 让顶部组件和关闭按钮融合 .ignoresSafeArea(.all, edges: .all)
实战代码
import SwiftUI
struct ContentView: View {
@State var selected = "house.fill"
@Namespace var animation
var body: some View {
VStack{
ZStack(alignment: Alignment(horizontal: .center, vertical: .bottom)){