Skip to content

Instantly share code, notes, and snippets.

View heydc7's full-sized avatar
🎯
Focusing

Dhanraj Chavan heydc7

🎯
Focusing
View GitHub Profile
echo "PWNED BY DC7"
@heydc7
heydc7 / Alert.swift
Last active April 22, 2022 04:34
Show multiple alerts in SwiftUI app
// Alert
@State private var showAlert = false
@State private var alertTitle: String = ""
@State private var alertMsg: String = ""
// UI
.alert(isPresented: self.$showAlert) {
Alert(title: Text(self.alertTitle), message: Text(self.alertMsg), dismissButton: .default(Text("Ok"), action: {
self.presentationMode.wrappedValue.dismiss()
}))
// SHOW SNACKBAR
void showSnakbar(String msg) {
var snackBar = SnackBar(content: Text(msg));
ScaffoldMessenger.of(context).showSnackBar(snackBar);
}
import SwiftUI
import Lottie
struct LottieView: UIViewRepresentable {
func makeCoordinator() -> Coordinator {
Coordinator(self)
}
var name: String!
import SwiftUI
import GoogleMobileAds
struct AdsView: UIViewRepresentable {
var bannerId: String
let banner = GADBannerView(adSize: kGADAdSizeBanner)
func makeCoordinator() -> Coordinator {
Coordinator(self)