From 3c13d2083baeeaa033ee7c59b08fe1f368d564d4 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Thu, 4 May 2023 10:01:32 -0400 Subject: [PATCH] Fix double nav controller in share extension --- ShareExtension/ShareViewController.swift | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/ShareExtension/ShareViewController.swift b/ShareExtension/ShareViewController.swift index 92dc26cb..e3000b3f 100644 --- a/ShareExtension/ShareViewController.swift +++ b/ShareExtension/ShareViewController.swift @@ -33,17 +33,16 @@ class ShareViewController: UIViewController { let context = ShareMastodonContext(accountInfo: account) let host = ShareHostingController(draft: draft, mastodonContext: context) - let nav = UINavigationController(rootViewController: host) - self.addChild(nav) - nav.view.translatesAutoresizingMaskIntoConstraints = false - self.view.addSubview(nav.view) + host.view.translatesAutoresizingMaskIntoConstraints = false + addChild(host) + self.view.addSubview(host.view) NSLayoutConstraint.activate([ - nav.view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor), - nav.view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor), - nav.view.topAnchor.constraint(equalTo: self.view.topAnchor), - nav.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor), + host.view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor), + host.view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor), + host.view.topAnchor.constraint(equalTo: self.view.topAnchor), + host.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor), ]) - nav.didMove(toParent: self) + host.didMove(toParent: self) } } else { state = .notLoggedIn