Skip to main content

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 underlying PDFView instance for rendering PDFs

Methods

  • setupViews(): Adds the PDF view to the controller's view hierarchy
  • setupLayouts(): Pins the PDF view to the controller's view
  • configure(with:): Loads a PDFDocument 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
}