美文网首页SwiftUI实战
SwiftUI实战-隐私政策和用户协议弹窗

SwiftUI实战-隐私政策和用户协议弹窗

作者: ISwiftUI | 来源:发表于2022-04-25 03:39 被阅读0次

    在实际的开发中,常常需要用户同意用户协议和隐私政策才可以正常的使用App

    效果图:


    隐私政策弹窗.png

    相关源码如下
    ContentView.swift

    import SwiftUI
    
    struct ContentView: View {
        
        @State private var isPresented = false
        
        var body: some View {
            VStack {
                Text("隐私政策")
                    .padding(.top, 100)
                    .foregroundColor(Color.blue)
                HStack {
                    Spacer()
                }
                Spacer()
            }.showPrivacyPolicyView(isPresented: $isPresented, action: { string in
                isPresented = false
                debugPrint(string)
            })
                .background(Color.gray)
                .edgesIgnoringSafeArea(Edge.Set.all)
                .onAppear {
                    isPresented = true
                }
        }
    }
    
    struct ContentView_Previews: PreviewProvider {
        static var previews: some View {
            ContentView()
        }
    }
    

    相关文章

      网友评论

        本文标题:SwiftUI实战-隐私政策和用户协议弹窗

        本文链接:https://www.haomeiwen.com/subject/fwbtyrtx.html