ReadKeep/URLShare/ShareViewController.swift

35 lines
1.2 KiB
Swift

//
// ShareViewController.swift
// URLShare
//
// Created by Ilyas Hallak on 11.06.25.
//
import UIKit
import Social
import UniformTypeIdentifiers
import SwiftUI
class ShareViewController: UIViewController {
private var hostingController: UIHostingController<ShareBookmarkView>?
override func viewDidLoad() {
super.viewDidLoad()
let viewModel = ShareBookmarkViewModel(extensionContext: extensionContext)
let swiftUIView = ShareBookmarkView(viewModel: viewModel)
let hostingController = UIHostingController(rootView: swiftUIView)
addChild(hostingController)
hostingController.view.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(hostingController.view)
NSLayoutConstraint.activate([
hostingController.view.topAnchor.constraint(equalTo: view.topAnchor),
hostingController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor),
hostingController.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
hostingController.view.trailingAnchor.constraint(equalTo: view.trailingAnchor)
])
hostingController.didMove(toParent: self)
self.hostingController = hostingController
}
}