More on ios share extension improvements

This commit is contained in:
Jackson Harper
2023-10-27 09:56:41 +08:00
parent cf3427fdc9
commit 8fe51a5f80
13 changed files with 477 additions and 79 deletions

View File

@ -1,20 +1,38 @@
import App
import SwiftUI
import Utils
import Views
#if os(iOS)
import UIKit
final class SheetViewController: UIViewController {}
@objc(ShareExtensionViewController)
final class ShareExtensionViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .clear
NotificationCenter.default.addObserver(forName: Notification.Name("ExpandForm"), object: nil, queue: OperationQueue.main) { _ in
self.openSheet()
}
embed(
childViewController: UIViewController.makeShareExtensionController(extensionContext: extensionContext),
heightRatio: 0.50
heightRatio: 0.60
)
}
@IBAction func openSheet() {
let hostingController = UIHostingController(rootView: AddNoteSheet())
present(hostingController, animated: true, completion: nil)
// Present it w/o any adjustments so it uses the default sheet presentation.
// present(sheetViewController., animated: true, completion: nil)
}
}
#elseif os(macOS)