Clean code
This commit is contained in:
parent
0e0166f308
commit
360833ae5f
@ -1,10 +1,3 @@
|
|||||||
//
|
|
||||||
// SesameApp.swift
|
|
||||||
// Sesame
|
|
||||||
//
|
|
||||||
// Created by iMac on 24.01.22.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
@main
|
@main
|
||||||
|
@ -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
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user