@thatkid02/react-native-pdf-viewer 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/PdfViewer.podspec +28 -0
- package/README.md +290 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +121 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/pdfviewer/HybridPdfViewer.kt +169 -0
- package/android/src/main/java/com/margelo/nitro/pdfviewer/PdfViewer.kt +996 -0
- package/android/src/main/java/com/margelo/nitro/pdfviewer/PdfViewerPackage.kt +26 -0
- package/ios/PdfViewer.swift +696 -0
- package/lib/module/PdfViewer.nitro.js +4 -0
- package/lib/module/PdfViewer.nitro.js.map +1 -0
- package/lib/module/index.js +13 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/PdfViewer.nitro.d.ts +67 -0
- package/lib/typescript/src/PdfViewer.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +8 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitro.json +17 -0
- package/nitrogen/generated/android/c++/JErrorEvent.hpp +57 -0
- package/nitrogen/generated/android/c++/JFunc_void_ErrorEvent.hpp +77 -0
- package/nitrogen/generated/android/c++/JFunc_void_LoadCompleteEvent.hpp +76 -0
- package/nitrogen/generated/android/c++/JFunc_void_LoadingChangeEvent.hpp +76 -0
- package/nitrogen/generated/android/c++/JFunc_void_PageChangeEvent.hpp +76 -0
- package/nitrogen/generated/android/c++/JFunc_void_ScaleChangeEvent.hpp +76 -0
- package/nitrogen/generated/android/c++/JFunc_void_ThumbnailGeneratedEvent.hpp +77 -0
- package/nitrogen/generated/android/c++/JHybridPdfViewerSpec.cpp +273 -0
- package/nitrogen/generated/android/c++/JHybridPdfViewerSpec.hpp +94 -0
- package/nitrogen/generated/android/c++/JLoadCompleteEvent.hpp +61 -0
- package/nitrogen/generated/android/c++/JLoadingChangeEvent.hpp +53 -0
- package/nitrogen/generated/android/c++/JPageChangeEvent.hpp +57 -0
- package/nitrogen/generated/android/c++/JScaleChangeEvent.hpp +53 -0
- package/nitrogen/generated/android/c++/JThumbnailGeneratedEvent.hpp +57 -0
- package/nitrogen/generated/android/c++/views/JHybridPdfViewerStateUpdater.cpp +108 -0
- package/nitrogen/generated/android/c++/views/JHybridPdfViewerStateUpdater.hpp +49 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/ErrorEvent.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/Func_void_ErrorEvent.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/Func_void_LoadCompleteEvent.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/Func_void_LoadingChangeEvent.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/Func_void_PageChangeEvent.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/Func_void_ScaleChangeEvent.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/Func_void_ThumbnailGeneratedEvent.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/HybridPdfViewerSpec.kt +195 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/LoadCompleteEvent.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/LoadingChangeEvent.kt +29 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/PageChangeEvent.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/ScaleChangeEvent.kt +29 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/ThumbnailGeneratedEvent.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/pdfviewerOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/views/HybridPdfViewerManager.kt +50 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/views/HybridPdfViewerStateUpdater.kt +23 -0
- package/nitrogen/generated/android/pdfviewer+autolinking.cmake +83 -0
- package/nitrogen/generated/android/pdfviewer+autolinking.gradle +27 -0
- package/nitrogen/generated/android/pdfviewerOnLoad.cpp +58 -0
- package/nitrogen/generated/android/pdfviewerOnLoad.hpp +25 -0
- package/nitrogen/generated/ios/PdfViewer+autolinking.rb +60 -0
- package/nitrogen/generated/ios/PdfViewer-Swift-Cxx-Bridge.cpp +80 -0
- package/nitrogen/generated/ios/PdfViewer-Swift-Cxx-Bridge.hpp +339 -0
- package/nitrogen/generated/ios/PdfViewer-Swift-Cxx-Umbrella.hpp +64 -0
- package/nitrogen/generated/ios/PdfViewerAutolinking.mm +33 -0
- package/nitrogen/generated/ios/PdfViewerAutolinking.swift +25 -0
- package/nitrogen/generated/ios/c++/HybridPdfViewerSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridPdfViewerSpecSwift.hpp +205 -0
- package/nitrogen/generated/ios/c++/views/HybridPdfViewerComponent.mm +161 -0
- package/nitrogen/generated/ios/swift/ErrorEvent.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_ErrorEvent.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_LoadCompleteEvent.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_LoadingChangeEvent.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_PageChangeEvent.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_ScaleChangeEvent.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_ThumbnailGeneratedEvent.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridPdfViewerSpec.swift +65 -0
- package/nitrogen/generated/ios/swift/HybridPdfViewerSpec_cxx.swift +500 -0
- package/nitrogen/generated/ios/swift/LoadCompleteEvent.swift +57 -0
- package/nitrogen/generated/ios/swift/LoadingChangeEvent.swift +35 -0
- package/nitrogen/generated/ios/swift/PageChangeEvent.swift +46 -0
- package/nitrogen/generated/ios/swift/ScaleChangeEvent.swift +35 -0
- package/nitrogen/generated/ios/swift/ThumbnailGeneratedEvent.swift +46 -0
- package/nitrogen/generated/shared/c++/ErrorEvent.hpp +71 -0
- package/nitrogen/generated/shared/c++/HybridPdfViewerSpec.cpp +52 -0
- package/nitrogen/generated/shared/c++/HybridPdfViewerSpec.hpp +111 -0
- package/nitrogen/generated/shared/c++/LoadCompleteEvent.hpp +75 -0
- package/nitrogen/generated/shared/c++/LoadingChangeEvent.hpp +67 -0
- package/nitrogen/generated/shared/c++/PageChangeEvent.hpp +71 -0
- package/nitrogen/generated/shared/c++/ScaleChangeEvent.hpp +67 -0
- package/nitrogen/generated/shared/c++/ThumbnailGeneratedEvent.hpp +71 -0
- package/nitrogen/generated/shared/c++/views/HybridPdfViewerComponent.cpp +243 -0
- package/nitrogen/generated/shared/c++/views/HybridPdfViewerComponent.hpp +127 -0
- package/nitrogen/generated/shared/json/PdfViewerConfig.json +23 -0
- package/package.json +175 -0
- package/src/PdfViewer.nitro.ts +97 -0
- package/src/index.tsx +27 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_ThumbnailGeneratedEvent.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a Swift `(_ event: ThumbnailGeneratedEvent) -> Void` as a class.
|
|
13
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
14
|
+
*/
|
|
15
|
+
public final class Func_void_ThumbnailGeneratedEvent {
|
|
16
|
+
public typealias bridge = margelo.nitro.pdfviewer.bridge.swift
|
|
17
|
+
|
|
18
|
+
private let closure: (_ event: ThumbnailGeneratedEvent) -> Void
|
|
19
|
+
|
|
20
|
+
public init(_ closure: @escaping (_ event: ThumbnailGeneratedEvent) -> Void) {
|
|
21
|
+
self.closure = closure
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@inline(__always)
|
|
25
|
+
public func call(event: ThumbnailGeneratedEvent) -> Void {
|
|
26
|
+
self.closure(event)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
31
|
+
* This acquires one additional strong reference on the object!
|
|
32
|
+
*/
|
|
33
|
+
@inline(__always)
|
|
34
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
35
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Casts an unsafe pointer to a `Func_void_ThumbnailGeneratedEvent`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_ThumbnailGeneratedEvent>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_ThumbnailGeneratedEvent {
|
|
45
|
+
return Unmanaged<Func_void_ThumbnailGeneratedEvent>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridPdfViewerSpec.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/// See ``HybridPdfViewerSpec``
|
|
12
|
+
public protocol HybridPdfViewerSpec_protocol: HybridObject, HybridView {
|
|
13
|
+
// Properties
|
|
14
|
+
var source: String? { get set }
|
|
15
|
+
var horizontal: Bool? { get set }
|
|
16
|
+
var enablePaging: Bool? { get set }
|
|
17
|
+
var spacing: Double? { get set }
|
|
18
|
+
var enableZoom: Bool? { get set }
|
|
19
|
+
var minScale: Double? { get set }
|
|
20
|
+
var maxScale: Double? { get set }
|
|
21
|
+
var showsActivityIndicator: Bool? { get set }
|
|
22
|
+
var onLoadComplete: ((_ event: LoadCompleteEvent) -> Void)? { get set }
|
|
23
|
+
var onPageChange: ((_ event: PageChangeEvent) -> Void)? { get set }
|
|
24
|
+
var onScaleChange: ((_ event: ScaleChangeEvent) -> Void)? { get set }
|
|
25
|
+
var onError: ((_ event: ErrorEvent) -> Void)? { get set }
|
|
26
|
+
var onThumbnailGenerated: ((_ event: ThumbnailGeneratedEvent) -> Void)? { get set }
|
|
27
|
+
var onLoadingChange: ((_ event: LoadingChangeEvent) -> Void)? { get set }
|
|
28
|
+
|
|
29
|
+
// Methods
|
|
30
|
+
func goToPage(page: Double) throws -> Void
|
|
31
|
+
func setScale(scale: Double) throws -> Void
|
|
32
|
+
func generateThumbnail(page: Double) throws -> Void
|
|
33
|
+
func generateAllThumbnails() throws -> Void
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/// See ``HybridPdfViewerSpec``
|
|
37
|
+
open class HybridPdfViewerSpec_base {
|
|
38
|
+
private weak var cxxWrapper: HybridPdfViewerSpec_cxx? = nil
|
|
39
|
+
public init() { }
|
|
40
|
+
public func getCxxWrapper() -> HybridPdfViewerSpec_cxx {
|
|
41
|
+
#if DEBUG
|
|
42
|
+
guard self is HybridPdfViewerSpec else {
|
|
43
|
+
fatalError("`self` is not a `HybridPdfViewerSpec`! Did you accidentally inherit from `HybridPdfViewerSpec_base` instead of `HybridPdfViewerSpec`?")
|
|
44
|
+
}
|
|
45
|
+
#endif
|
|
46
|
+
if let cxxWrapper = self.cxxWrapper {
|
|
47
|
+
return cxxWrapper
|
|
48
|
+
} else {
|
|
49
|
+
let cxxWrapper = HybridPdfViewerSpec_cxx(self as! HybridPdfViewerSpec)
|
|
50
|
+
self.cxxWrapper = cxxWrapper
|
|
51
|
+
return cxxWrapper
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* A Swift base-protocol representing the PdfViewer HybridObject.
|
|
58
|
+
* Implement this protocol to create Swift-based instances of PdfViewer.
|
|
59
|
+
* ```swift
|
|
60
|
+
* class HybridPdfViewer : HybridPdfViewerSpec {
|
|
61
|
+
* // ...
|
|
62
|
+
* }
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
public typealias HybridPdfViewerSpec = HybridPdfViewerSpec_protocol & HybridPdfViewerSpec_base
|
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridPdfViewerSpec_cxx.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A class implementation that bridges HybridPdfViewerSpec over to C++.
|
|
13
|
+
* In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
|
|
14
|
+
*
|
|
15
|
+
* Also, some Swift types need to be bridged with special handling:
|
|
16
|
+
* - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
|
|
17
|
+
* - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
|
|
18
|
+
* - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
|
|
19
|
+
*/
|
|
20
|
+
open class HybridPdfViewerSpec_cxx {
|
|
21
|
+
/**
|
|
22
|
+
* The Swift <> C++ bridge's namespace (`margelo::nitro::pdfviewer::bridge::swift`)
|
|
23
|
+
* from `PdfViewer-Swift-Cxx-Bridge.hpp`.
|
|
24
|
+
* This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
|
|
25
|
+
*/
|
|
26
|
+
public typealias bridge = margelo.nitro.pdfviewer.bridge.swift
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Holds an instance of the `HybridPdfViewerSpec` Swift protocol.
|
|
30
|
+
*/
|
|
31
|
+
private var __implementation: any HybridPdfViewerSpec
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Holds a weak pointer to the C++ class that wraps the Swift class.
|
|
35
|
+
*/
|
|
36
|
+
private var __cxxPart: bridge.std__weak_ptr_HybridPdfViewerSpec_
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Create a new `HybridPdfViewerSpec_cxx` that wraps the given `HybridPdfViewerSpec`.
|
|
40
|
+
* All properties and methods bridge to C++ types.
|
|
41
|
+
*/
|
|
42
|
+
public init(_ implementation: any HybridPdfViewerSpec) {
|
|
43
|
+
self.__implementation = implementation
|
|
44
|
+
self.__cxxPart = .init()
|
|
45
|
+
/* no base class */
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Get the actual `HybridPdfViewerSpec` instance this class wraps.
|
|
50
|
+
*/
|
|
51
|
+
@inline(__always)
|
|
52
|
+
public func getHybridPdfViewerSpec() -> any HybridPdfViewerSpec {
|
|
53
|
+
return __implementation
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
58
|
+
* This acquires one additional strong reference on the object!
|
|
59
|
+
*/
|
|
60
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
61
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Casts an unsafe pointer to a `HybridPdfViewerSpec_cxx`.
|
|
66
|
+
* The pointer has to be a retained opaque `Unmanaged<HybridPdfViewerSpec_cxx>`.
|
|
67
|
+
* This removes one strong reference from the object!
|
|
68
|
+
*/
|
|
69
|
+
public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridPdfViewerSpec_cxx {
|
|
70
|
+
return Unmanaged<HybridPdfViewerSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Gets (or creates) the C++ part of this Hybrid Object.
|
|
75
|
+
* The C++ part is a `std::shared_ptr<HybridPdfViewerSpec>`.
|
|
76
|
+
*/
|
|
77
|
+
public func getCxxPart() -> bridge.std__shared_ptr_HybridPdfViewerSpec_ {
|
|
78
|
+
let cachedCxxPart = self.__cxxPart.lock()
|
|
79
|
+
if cachedCxxPart.__convertToBool() {
|
|
80
|
+
return cachedCxxPart
|
|
81
|
+
} else {
|
|
82
|
+
let newCxxPart = bridge.create_std__shared_ptr_HybridPdfViewerSpec_(self.toUnsafe())
|
|
83
|
+
__cxxPart = bridge.weakify_std__shared_ptr_HybridPdfViewerSpec_(newCxxPart)
|
|
84
|
+
return newCxxPart
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Get the memory size of the Swift class (plus size of any other allocations)
|
|
92
|
+
* so the JS VM can properly track it and garbage-collect the JS object if needed.
|
|
93
|
+
*/
|
|
94
|
+
@inline(__always)
|
|
95
|
+
public var memorySize: Int {
|
|
96
|
+
return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Call dispose() on the Swift class.
|
|
101
|
+
* This _may_ be called manually from JS.
|
|
102
|
+
*/
|
|
103
|
+
@inline(__always)
|
|
104
|
+
public func dispose() {
|
|
105
|
+
self.__implementation.dispose()
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Properties
|
|
109
|
+
public final var source: bridge.std__optional_std__string_ {
|
|
110
|
+
@inline(__always)
|
|
111
|
+
get {
|
|
112
|
+
return { () -> bridge.std__optional_std__string_ in
|
|
113
|
+
if let __unwrappedValue = self.__implementation.source {
|
|
114
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
115
|
+
} else {
|
|
116
|
+
return .init()
|
|
117
|
+
}
|
|
118
|
+
}()
|
|
119
|
+
}
|
|
120
|
+
@inline(__always)
|
|
121
|
+
set {
|
|
122
|
+
self.__implementation.source = { () -> String? in
|
|
123
|
+
if bridge.has_value_std__optional_std__string_(newValue) {
|
|
124
|
+
let __unwrapped = bridge.get_std__optional_std__string_(newValue)
|
|
125
|
+
return String(__unwrapped)
|
|
126
|
+
} else {
|
|
127
|
+
return nil
|
|
128
|
+
}
|
|
129
|
+
}()
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
public final var horizontal: bridge.std__optional_bool_ {
|
|
134
|
+
@inline(__always)
|
|
135
|
+
get {
|
|
136
|
+
return { () -> bridge.std__optional_bool_ in
|
|
137
|
+
if let __unwrappedValue = self.__implementation.horizontal {
|
|
138
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
139
|
+
} else {
|
|
140
|
+
return .init()
|
|
141
|
+
}
|
|
142
|
+
}()
|
|
143
|
+
}
|
|
144
|
+
@inline(__always)
|
|
145
|
+
set {
|
|
146
|
+
self.__implementation.horizontal = newValue.value
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
public final var enablePaging: bridge.std__optional_bool_ {
|
|
151
|
+
@inline(__always)
|
|
152
|
+
get {
|
|
153
|
+
return { () -> bridge.std__optional_bool_ in
|
|
154
|
+
if let __unwrappedValue = self.__implementation.enablePaging {
|
|
155
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
156
|
+
} else {
|
|
157
|
+
return .init()
|
|
158
|
+
}
|
|
159
|
+
}()
|
|
160
|
+
}
|
|
161
|
+
@inline(__always)
|
|
162
|
+
set {
|
|
163
|
+
self.__implementation.enablePaging = newValue.value
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
public final var spacing: bridge.std__optional_double_ {
|
|
168
|
+
@inline(__always)
|
|
169
|
+
get {
|
|
170
|
+
return { () -> bridge.std__optional_double_ in
|
|
171
|
+
if let __unwrappedValue = self.__implementation.spacing {
|
|
172
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
173
|
+
} else {
|
|
174
|
+
return .init()
|
|
175
|
+
}
|
|
176
|
+
}()
|
|
177
|
+
}
|
|
178
|
+
@inline(__always)
|
|
179
|
+
set {
|
|
180
|
+
self.__implementation.spacing = newValue.value
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
public final var enableZoom: bridge.std__optional_bool_ {
|
|
185
|
+
@inline(__always)
|
|
186
|
+
get {
|
|
187
|
+
return { () -> bridge.std__optional_bool_ in
|
|
188
|
+
if let __unwrappedValue = self.__implementation.enableZoom {
|
|
189
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
190
|
+
} else {
|
|
191
|
+
return .init()
|
|
192
|
+
}
|
|
193
|
+
}()
|
|
194
|
+
}
|
|
195
|
+
@inline(__always)
|
|
196
|
+
set {
|
|
197
|
+
self.__implementation.enableZoom = newValue.value
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
public final var minScale: bridge.std__optional_double_ {
|
|
202
|
+
@inline(__always)
|
|
203
|
+
get {
|
|
204
|
+
return { () -> bridge.std__optional_double_ in
|
|
205
|
+
if let __unwrappedValue = self.__implementation.minScale {
|
|
206
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
207
|
+
} else {
|
|
208
|
+
return .init()
|
|
209
|
+
}
|
|
210
|
+
}()
|
|
211
|
+
}
|
|
212
|
+
@inline(__always)
|
|
213
|
+
set {
|
|
214
|
+
self.__implementation.minScale = newValue.value
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
public final var maxScale: bridge.std__optional_double_ {
|
|
219
|
+
@inline(__always)
|
|
220
|
+
get {
|
|
221
|
+
return { () -> bridge.std__optional_double_ in
|
|
222
|
+
if let __unwrappedValue = self.__implementation.maxScale {
|
|
223
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
224
|
+
} else {
|
|
225
|
+
return .init()
|
|
226
|
+
}
|
|
227
|
+
}()
|
|
228
|
+
}
|
|
229
|
+
@inline(__always)
|
|
230
|
+
set {
|
|
231
|
+
self.__implementation.maxScale = newValue.value
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
public final var showsActivityIndicator: bridge.std__optional_bool_ {
|
|
236
|
+
@inline(__always)
|
|
237
|
+
get {
|
|
238
|
+
return { () -> bridge.std__optional_bool_ in
|
|
239
|
+
if let __unwrappedValue = self.__implementation.showsActivityIndicator {
|
|
240
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
241
|
+
} else {
|
|
242
|
+
return .init()
|
|
243
|
+
}
|
|
244
|
+
}()
|
|
245
|
+
}
|
|
246
|
+
@inline(__always)
|
|
247
|
+
set {
|
|
248
|
+
self.__implementation.showsActivityIndicator = newValue.value
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
public final var onLoadComplete: bridge.std__optional_std__function_void_const_LoadCompleteEvent_____event______ {
|
|
253
|
+
@inline(__always)
|
|
254
|
+
get {
|
|
255
|
+
return { () -> bridge.std__optional_std__function_void_const_LoadCompleteEvent_____event______ in
|
|
256
|
+
if let __unwrappedValue = self.__implementation.onLoadComplete {
|
|
257
|
+
return bridge.create_std__optional_std__function_void_const_LoadCompleteEvent_____event______({ () -> bridge.Func_void_LoadCompleteEvent in
|
|
258
|
+
let __closureWrapper = Func_void_LoadCompleteEvent(__unwrappedValue)
|
|
259
|
+
return bridge.create_Func_void_LoadCompleteEvent(__closureWrapper.toUnsafe())
|
|
260
|
+
}())
|
|
261
|
+
} else {
|
|
262
|
+
return .init()
|
|
263
|
+
}
|
|
264
|
+
}()
|
|
265
|
+
}
|
|
266
|
+
@inline(__always)
|
|
267
|
+
set {
|
|
268
|
+
self.__implementation.onLoadComplete = { () -> ((_ event: LoadCompleteEvent) -> Void)? in
|
|
269
|
+
if bridge.has_value_std__optional_std__function_void_const_LoadCompleteEvent_____event______(newValue) {
|
|
270
|
+
let __unwrapped = bridge.get_std__optional_std__function_void_const_LoadCompleteEvent_____event______(newValue)
|
|
271
|
+
return { () -> (LoadCompleteEvent) -> Void in
|
|
272
|
+
let __wrappedFunction = bridge.wrap_Func_void_LoadCompleteEvent(__unwrapped)
|
|
273
|
+
return { (__event: LoadCompleteEvent) -> Void in
|
|
274
|
+
__wrappedFunction.call(__event)
|
|
275
|
+
}
|
|
276
|
+
}()
|
|
277
|
+
} else {
|
|
278
|
+
return nil
|
|
279
|
+
}
|
|
280
|
+
}()
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
public final var onPageChange: bridge.std__optional_std__function_void_const_PageChangeEvent_____event______ {
|
|
285
|
+
@inline(__always)
|
|
286
|
+
get {
|
|
287
|
+
return { () -> bridge.std__optional_std__function_void_const_PageChangeEvent_____event______ in
|
|
288
|
+
if let __unwrappedValue = self.__implementation.onPageChange {
|
|
289
|
+
return bridge.create_std__optional_std__function_void_const_PageChangeEvent_____event______({ () -> bridge.Func_void_PageChangeEvent in
|
|
290
|
+
let __closureWrapper = Func_void_PageChangeEvent(__unwrappedValue)
|
|
291
|
+
return bridge.create_Func_void_PageChangeEvent(__closureWrapper.toUnsafe())
|
|
292
|
+
}())
|
|
293
|
+
} else {
|
|
294
|
+
return .init()
|
|
295
|
+
}
|
|
296
|
+
}()
|
|
297
|
+
}
|
|
298
|
+
@inline(__always)
|
|
299
|
+
set {
|
|
300
|
+
self.__implementation.onPageChange = { () -> ((_ event: PageChangeEvent) -> Void)? in
|
|
301
|
+
if bridge.has_value_std__optional_std__function_void_const_PageChangeEvent_____event______(newValue) {
|
|
302
|
+
let __unwrapped = bridge.get_std__optional_std__function_void_const_PageChangeEvent_____event______(newValue)
|
|
303
|
+
return { () -> (PageChangeEvent) -> Void in
|
|
304
|
+
let __wrappedFunction = bridge.wrap_Func_void_PageChangeEvent(__unwrapped)
|
|
305
|
+
return { (__event: PageChangeEvent) -> Void in
|
|
306
|
+
__wrappedFunction.call(__event)
|
|
307
|
+
}
|
|
308
|
+
}()
|
|
309
|
+
} else {
|
|
310
|
+
return nil
|
|
311
|
+
}
|
|
312
|
+
}()
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
public final var onScaleChange: bridge.std__optional_std__function_void_const_ScaleChangeEvent_____event______ {
|
|
317
|
+
@inline(__always)
|
|
318
|
+
get {
|
|
319
|
+
return { () -> bridge.std__optional_std__function_void_const_ScaleChangeEvent_____event______ in
|
|
320
|
+
if let __unwrappedValue = self.__implementation.onScaleChange {
|
|
321
|
+
return bridge.create_std__optional_std__function_void_const_ScaleChangeEvent_____event______({ () -> bridge.Func_void_ScaleChangeEvent in
|
|
322
|
+
let __closureWrapper = Func_void_ScaleChangeEvent(__unwrappedValue)
|
|
323
|
+
return bridge.create_Func_void_ScaleChangeEvent(__closureWrapper.toUnsafe())
|
|
324
|
+
}())
|
|
325
|
+
} else {
|
|
326
|
+
return .init()
|
|
327
|
+
}
|
|
328
|
+
}()
|
|
329
|
+
}
|
|
330
|
+
@inline(__always)
|
|
331
|
+
set {
|
|
332
|
+
self.__implementation.onScaleChange = { () -> ((_ event: ScaleChangeEvent) -> Void)? in
|
|
333
|
+
if bridge.has_value_std__optional_std__function_void_const_ScaleChangeEvent_____event______(newValue) {
|
|
334
|
+
let __unwrapped = bridge.get_std__optional_std__function_void_const_ScaleChangeEvent_____event______(newValue)
|
|
335
|
+
return { () -> (ScaleChangeEvent) -> Void in
|
|
336
|
+
let __wrappedFunction = bridge.wrap_Func_void_ScaleChangeEvent(__unwrapped)
|
|
337
|
+
return { (__event: ScaleChangeEvent) -> Void in
|
|
338
|
+
__wrappedFunction.call(__event)
|
|
339
|
+
}
|
|
340
|
+
}()
|
|
341
|
+
} else {
|
|
342
|
+
return nil
|
|
343
|
+
}
|
|
344
|
+
}()
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
public final var onError: bridge.std__optional_std__function_void_const_ErrorEvent_____event______ {
|
|
349
|
+
@inline(__always)
|
|
350
|
+
get {
|
|
351
|
+
return { () -> bridge.std__optional_std__function_void_const_ErrorEvent_____event______ in
|
|
352
|
+
if let __unwrappedValue = self.__implementation.onError {
|
|
353
|
+
return bridge.create_std__optional_std__function_void_const_ErrorEvent_____event______({ () -> bridge.Func_void_ErrorEvent in
|
|
354
|
+
let __closureWrapper = Func_void_ErrorEvent(__unwrappedValue)
|
|
355
|
+
return bridge.create_Func_void_ErrorEvent(__closureWrapper.toUnsafe())
|
|
356
|
+
}())
|
|
357
|
+
} else {
|
|
358
|
+
return .init()
|
|
359
|
+
}
|
|
360
|
+
}()
|
|
361
|
+
}
|
|
362
|
+
@inline(__always)
|
|
363
|
+
set {
|
|
364
|
+
self.__implementation.onError = { () -> ((_ event: ErrorEvent) -> Void)? in
|
|
365
|
+
if bridge.has_value_std__optional_std__function_void_const_ErrorEvent_____event______(newValue) {
|
|
366
|
+
let __unwrapped = bridge.get_std__optional_std__function_void_const_ErrorEvent_____event______(newValue)
|
|
367
|
+
return { () -> (ErrorEvent) -> Void in
|
|
368
|
+
let __wrappedFunction = bridge.wrap_Func_void_ErrorEvent(__unwrapped)
|
|
369
|
+
return { (__event: ErrorEvent) -> Void in
|
|
370
|
+
__wrappedFunction.call(__event)
|
|
371
|
+
}
|
|
372
|
+
}()
|
|
373
|
+
} else {
|
|
374
|
+
return nil
|
|
375
|
+
}
|
|
376
|
+
}()
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
public final var onThumbnailGenerated: bridge.std__optional_std__function_void_const_ThumbnailGeneratedEvent_____event______ {
|
|
381
|
+
@inline(__always)
|
|
382
|
+
get {
|
|
383
|
+
return { () -> bridge.std__optional_std__function_void_const_ThumbnailGeneratedEvent_____event______ in
|
|
384
|
+
if let __unwrappedValue = self.__implementation.onThumbnailGenerated {
|
|
385
|
+
return bridge.create_std__optional_std__function_void_const_ThumbnailGeneratedEvent_____event______({ () -> bridge.Func_void_ThumbnailGeneratedEvent in
|
|
386
|
+
let __closureWrapper = Func_void_ThumbnailGeneratedEvent(__unwrappedValue)
|
|
387
|
+
return bridge.create_Func_void_ThumbnailGeneratedEvent(__closureWrapper.toUnsafe())
|
|
388
|
+
}())
|
|
389
|
+
} else {
|
|
390
|
+
return .init()
|
|
391
|
+
}
|
|
392
|
+
}()
|
|
393
|
+
}
|
|
394
|
+
@inline(__always)
|
|
395
|
+
set {
|
|
396
|
+
self.__implementation.onThumbnailGenerated = { () -> ((_ event: ThumbnailGeneratedEvent) -> Void)? in
|
|
397
|
+
if bridge.has_value_std__optional_std__function_void_const_ThumbnailGeneratedEvent_____event______(newValue) {
|
|
398
|
+
let __unwrapped = bridge.get_std__optional_std__function_void_const_ThumbnailGeneratedEvent_____event______(newValue)
|
|
399
|
+
return { () -> (ThumbnailGeneratedEvent) -> Void in
|
|
400
|
+
let __wrappedFunction = bridge.wrap_Func_void_ThumbnailGeneratedEvent(__unwrapped)
|
|
401
|
+
return { (__event: ThumbnailGeneratedEvent) -> Void in
|
|
402
|
+
__wrappedFunction.call(__event)
|
|
403
|
+
}
|
|
404
|
+
}()
|
|
405
|
+
} else {
|
|
406
|
+
return nil
|
|
407
|
+
}
|
|
408
|
+
}()
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
public final var onLoadingChange: bridge.std__optional_std__function_void_const_LoadingChangeEvent_____event______ {
|
|
413
|
+
@inline(__always)
|
|
414
|
+
get {
|
|
415
|
+
return { () -> bridge.std__optional_std__function_void_const_LoadingChangeEvent_____event______ in
|
|
416
|
+
if let __unwrappedValue = self.__implementation.onLoadingChange {
|
|
417
|
+
return bridge.create_std__optional_std__function_void_const_LoadingChangeEvent_____event______({ () -> bridge.Func_void_LoadingChangeEvent in
|
|
418
|
+
let __closureWrapper = Func_void_LoadingChangeEvent(__unwrappedValue)
|
|
419
|
+
return bridge.create_Func_void_LoadingChangeEvent(__closureWrapper.toUnsafe())
|
|
420
|
+
}())
|
|
421
|
+
} else {
|
|
422
|
+
return .init()
|
|
423
|
+
}
|
|
424
|
+
}()
|
|
425
|
+
}
|
|
426
|
+
@inline(__always)
|
|
427
|
+
set {
|
|
428
|
+
self.__implementation.onLoadingChange = { () -> ((_ event: LoadingChangeEvent) -> Void)? in
|
|
429
|
+
if bridge.has_value_std__optional_std__function_void_const_LoadingChangeEvent_____event______(newValue) {
|
|
430
|
+
let __unwrapped = bridge.get_std__optional_std__function_void_const_LoadingChangeEvent_____event______(newValue)
|
|
431
|
+
return { () -> (LoadingChangeEvent) -> Void in
|
|
432
|
+
let __wrappedFunction = bridge.wrap_Func_void_LoadingChangeEvent(__unwrapped)
|
|
433
|
+
return { (__event: LoadingChangeEvent) -> Void in
|
|
434
|
+
__wrappedFunction.call(__event)
|
|
435
|
+
}
|
|
436
|
+
}()
|
|
437
|
+
} else {
|
|
438
|
+
return nil
|
|
439
|
+
}
|
|
440
|
+
}()
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
// Methods
|
|
445
|
+
@inline(__always)
|
|
446
|
+
public final func goToPage(page: Double) -> bridge.Result_void_ {
|
|
447
|
+
do {
|
|
448
|
+
try self.__implementation.goToPage(page: page)
|
|
449
|
+
return bridge.create_Result_void_()
|
|
450
|
+
} catch (let __error) {
|
|
451
|
+
let __exceptionPtr = __error.toCpp()
|
|
452
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
@inline(__always)
|
|
457
|
+
public final func setScale(scale: Double) -> bridge.Result_void_ {
|
|
458
|
+
do {
|
|
459
|
+
try self.__implementation.setScale(scale: scale)
|
|
460
|
+
return bridge.create_Result_void_()
|
|
461
|
+
} catch (let __error) {
|
|
462
|
+
let __exceptionPtr = __error.toCpp()
|
|
463
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
@inline(__always)
|
|
468
|
+
public final func generateThumbnail(page: Double) -> bridge.Result_void_ {
|
|
469
|
+
do {
|
|
470
|
+
try self.__implementation.generateThumbnail(page: page)
|
|
471
|
+
return bridge.create_Result_void_()
|
|
472
|
+
} catch (let __error) {
|
|
473
|
+
let __exceptionPtr = __error.toCpp()
|
|
474
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
@inline(__always)
|
|
479
|
+
public final func generateAllThumbnails() -> bridge.Result_void_ {
|
|
480
|
+
do {
|
|
481
|
+
try self.__implementation.generateAllThumbnails()
|
|
482
|
+
return bridge.create_Result_void_()
|
|
483
|
+
} catch (let __error) {
|
|
484
|
+
let __exceptionPtr = __error.toCpp()
|
|
485
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
public final func getView() -> UnsafeMutableRawPointer {
|
|
490
|
+
return Unmanaged.passRetained(__implementation.view).toOpaque()
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
public final func beforeUpdate() {
|
|
494
|
+
__implementation.beforeUpdate()
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
public final func afterUpdate() {
|
|
498
|
+
__implementation.afterUpdate()
|
|
499
|
+
}
|
|
500
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// LoadCompleteEvent.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `LoadCompleteEvent`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias LoadCompleteEvent = margelo.nitro.pdfviewer.LoadCompleteEvent
|
|
14
|
+
|
|
15
|
+
public extension LoadCompleteEvent {
|
|
16
|
+
private typealias bridge = margelo.nitro.pdfviewer.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `LoadCompleteEvent`.
|
|
20
|
+
*/
|
|
21
|
+
init(pageCount: Double, pageWidth: Double, pageHeight: Double) {
|
|
22
|
+
self.init(pageCount, pageWidth, pageHeight)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var pageCount: Double {
|
|
26
|
+
@inline(__always)
|
|
27
|
+
get {
|
|
28
|
+
return self.__pageCount
|
|
29
|
+
}
|
|
30
|
+
@inline(__always)
|
|
31
|
+
set {
|
|
32
|
+
self.__pageCount = newValue
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var pageWidth: Double {
|
|
37
|
+
@inline(__always)
|
|
38
|
+
get {
|
|
39
|
+
return self.__pageWidth
|
|
40
|
+
}
|
|
41
|
+
@inline(__always)
|
|
42
|
+
set {
|
|
43
|
+
self.__pageWidth = newValue
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
var pageHeight: Double {
|
|
48
|
+
@inline(__always)
|
|
49
|
+
get {
|
|
50
|
+
return self.__pageHeight
|
|
51
|
+
}
|
|
52
|
+
@inline(__always)
|
|
53
|
+
set {
|
|
54
|
+
self.__pageHeight = newValue
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// LoadingChangeEvent.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `LoadingChangeEvent`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias LoadingChangeEvent = margelo.nitro.pdfviewer.LoadingChangeEvent
|
|
14
|
+
|
|
15
|
+
public extension LoadingChangeEvent {
|
|
16
|
+
private typealias bridge = margelo.nitro.pdfviewer.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `LoadingChangeEvent`.
|
|
20
|
+
*/
|
|
21
|
+
init(isLoading: Bool) {
|
|
22
|
+
self.init(isLoading)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var isLoading: Bool {
|
|
26
|
+
@inline(__always)
|
|
27
|
+
get {
|
|
28
|
+
return self.__isLoading
|
|
29
|
+
}
|
|
30
|
+
@inline(__always)
|
|
31
|
+
set {
|
|
32
|
+
self.__isLoading = newValue
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|