Fix double nav controller in share extension

This commit is contained in:
Shadowfacts 2023-05-04 10:01:32 -04:00
parent ad55851090
commit 3c13d2083b
1 changed files with 8 additions and 9 deletions

View File

@ -33,17 +33,16 @@ class ShareViewController: UIViewController {
let context = ShareMastodonContext(accountInfo: account) let context = ShareMastodonContext(accountInfo: account)
let host = ShareHostingController(draft: draft, mastodonContext: context) let host = ShareHostingController(draft: draft, mastodonContext: context)
let nav = UINavigationController(rootViewController: host) host.view.translatesAutoresizingMaskIntoConstraints = false
self.addChild(nav) addChild(host)
nav.view.translatesAutoresizingMaskIntoConstraints = false self.view.addSubview(host.view)
self.view.addSubview(nav.view)
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([
nav.view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor), host.view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
nav.view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor), host.view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor),
nav.view.topAnchor.constraint(equalTo: self.view.topAnchor), host.view.topAnchor.constraint(equalTo: self.view.topAnchor),
nav.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor), host.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
]) ])
nav.didMove(toParent: self) host.didMove(toParent: self)
} }
} else { } else {
state = .notLoggedIn state = .notLoggedIn