Clean code

This commit is contained in:
Christoph Hagen 2022-04-13 14:55:57 +02:00
parent 0e0166f308
commit 360833ae5f
2 changed files with 0 additions and 28 deletions

View File

@ -1,10 +1,3 @@
//
// SesameApp.swift
// Sesame
//
// Created by iMac on 24.01.22.
//
import SwiftUI import SwiftUI
@main @main

View File

@ -1,21 +0,0 @@
import SwiftUI
extension UIApplication {
static let keyWindow = keyWindowScene?.windows.filter(\.isKeyWindow).first
static let keyWindowScene = shared.connectedScenes.first { $0.activationState == .foregroundActive } as? UIWindowScene
}
extension View {
func shareSheet(isPresented: Binding<Bool>, items: [Any]) -> some View {
guard isPresented.wrappedValue else { return self }
let activityViewController = UIActivityViewController(activityItems: items, applicationActivities: nil)
let presentedViewController = UIApplication.keyWindow?.rootViewController?.presentedViewController ?? UIApplication.keyWindow?.rootViewController
activityViewController.completionWithItemsHandler = { _, _, _, _ in isPresented.wrappedValue = false }
presentedViewController?.present(activityViewController, animated: true)
return self
}
}