- Added search functionality to BookmarkLabelsView with real-time filtering - Implemented custom tag creation with smart suggestions - Unified search and tag selection in ShareBookmarkView - Added keyboard toolbar with 'Done' button for extensions - Implemented notification-based keyboard dismissal for extensions - Added pagination logic to ShareBookmarkViewModel - Created selected tags section with remove functionality - Improved UX with consistent tag management across views - Added proper keyboard handling for iOS extensions
50 lines
1.6 KiB
Swift
50 lines
1.6 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
|
|
|
|
NotificationCenter.default.addObserver(
|
|
self,
|
|
selector: #selector(dismissKeyboard),
|
|
name: NSNotification.Name("DismissKeyboard"),
|
|
object: nil
|
|
)
|
|
}
|
|
|
|
@objc private func dismissKeyboard() {
|
|
self.view.endEditing(true)
|
|
}
|
|
|
|
deinit {
|
|
NotificationCenter.default.removeObserver(self)
|
|
}
|
|
}
|