From 360833ae5f0af5f69e34f315c641aadda70f0143 Mon Sep 17 00:00:00 2001 From: Christoph Hagen Date: Wed, 13 Apr 2022 14:55:57 +0200 Subject: [PATCH] Clean code --- Sesame/SesameApp.swift | 7 ------- Sesame/ShareSheet.swift | 21 --------------------- 2 files changed, 28 deletions(-) delete mode 100644 Sesame/ShareSheet.swift diff --git a/Sesame/SesameApp.swift b/Sesame/SesameApp.swift index bd71bbc..2e55633 100644 --- a/Sesame/SesameApp.swift +++ b/Sesame/SesameApp.swift @@ -1,10 +1,3 @@ -// -// SesameApp.swift -// Sesame -// -// Created by iMac on 24.01.22. -// - import SwiftUI @main diff --git a/Sesame/ShareSheet.swift b/Sesame/ShareSheet.swift deleted file mode 100644 index fc9fc1f..0000000 --- a/Sesame/ShareSheet.swift +++ /dev/null @@ -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, 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 - } - -}