SwiftUI实战

SwiftUI实战-自定义底部弹窗

2022-05-03  本文已影响0人  ISwiftUI

自定义底部弹窗

效果图:


底部弹窗.gif

相关源码如下:
ContentView.swift

import SwiftUI

struct ContentView: View {
    @State var isPresented = false
    
    var body: some View {
        VStack {
            Text("点我")
                .foregroundColor(Color.orange)
                .onTapGesture {
                    isPresented.toggle()
                }
        }.frame(maxWidth: .infinity, maxHeight: .infinity)
            .showCSBottomSheet(isPresented: $isPresented)
            
    }
}

CSBottomSheet.swift

上一篇下一篇

猜你喜欢

热点阅读