LMFeedPDFViewer
Overview
The LMFeedPDFViewer
is a PDF viewing component that extends LMFeedViewController
and uses PDFKit
to display PDF documents. It provides a simple interface for embedding PDF viewing functionality in your feed or app.
File Location:
LMFeedPDFViewer.swift
Functionality
UI Components
pdfViewer
: The underlyingPDFView
instance for rendering PDFs
Methods
setupViews()
: Adds the PDF view to the controller's view hierarchysetupLayouts()
: Pins the PDF view to the controller's viewconfigure(with:)
: Loads aPDFDocument
into the viewer
Delegate
- Implements
PDFViewDelegate
to handle link clicks and other PDF interactions
Customization
CustomFeedPDFViewer.swift
class CustomFeedPDFViewer: LMFeedPDFViewer {
override func setupViews() {
super.setupViews()
// Add custom views if needed
}
override func setupLayouts() {
super.setupLayouts()
// Add custom layout constraints if needed
}
}
AppDelegate.swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
LMUIComponents.shared.pdfViewer = CustomFeedPDFViewer.self
// ...
return true
}