SPAlert https://github.com/ivanvorobei/SPAlert
ContentView.swift
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | // // ContentView.swift // SwiftUIProject // // Created by Cairocoders // import SwiftUI import SPAlert struct ContentView: View { @State var showAlert = false @State var showAlert2 = false var body: some View { VStack(spacing: 20) { Button( "Show Alert" ) { showAlert.toggle() } .SPAlert( isPresent: $showAlert, message: "SwiftUI Alert - SPAlert Package" , duration: 1.0) Button( "Show Alert 2" ) { showAlert2.toggle() } .SPAlert( isPresent: $showAlert2, title: "SPAlert Package" , message: "This tutorial has been completed" , duration: 2.0, dismissOnTap: false , preset: .done, //preset: .custom(UIImage(systemName: "checkmark.seal.fill")!), haptic: .success, layout: .init(), completion: { print( "This is a completion log." ) showAlert.toggle() }) .tint(.orange) } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } } |