Skip to content

Commit ea9ad3e

Browse files
authored
[PdfKit] Implement Xcode 16.2 beta 1-3 changes. (#21739)
This is basically adding PdfKit to tvOS.
1 parent 00b4c2c commit ea9ad3e

File tree

16 files changed

+125
-566
lines changed

16 files changed

+125
-566
lines changed

src/PdfKit/Enums.cs

+16-5
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@
3232

3333
#nullable enable
3434

35-
#if MONOMAC || IOS
35+
#if MONOMAC || IOS || TVOS
3636

3737
namespace PdfKit {
3838

3939
[Native]
40+
[TV (18, 2)]
4041
public enum PdfActionNamedName : long {
4142
None = 0,
4243
NextPage = 1,
@@ -53,6 +54,7 @@ public enum PdfActionNamedName : long {
5354
}
5455

5556
[Native]
57+
[TV (18, 2)]
5658
public enum PdfWidgetControlType : long {
5759
Unknown = -1,
5860
PushButton = 0,
@@ -61,6 +63,7 @@ public enum PdfWidgetControlType : long {
6163
}
6264

6365
[Native]
66+
[TV (18, 2)]
6467
public enum PdfLineStyle : long {
6568
None = 0,
6669
Square = 1,
@@ -71,6 +74,7 @@ public enum PdfLineStyle : long {
7174
}
7275

7376
[Native]
77+
[TV (18, 2)]
7478
public enum PdfMarkupType : long {
7579
Highlight = 0,
7680
StrikeOut = 1,
@@ -79,6 +83,7 @@ public enum PdfMarkupType : long {
7983
}
8084

8185
[Native]
86+
[TV (18, 2)]
8287
public enum PdfTextAnnotationIconType : long {
8388
Comment = 0,
8489
Key = 1,
@@ -90,6 +95,7 @@ public enum PdfTextAnnotationIconType : long {
9095
}
9196

9297
[Native]
98+
[TV (18, 2)]
9399
public enum PdfBorderStyle : long {
94100
Solid = 0,
95101
Dashed = 1,
@@ -98,12 +104,9 @@ public enum PdfBorderStyle : long {
98104
Underline = 4
99105
}
100106

101-
#if NET
102107
/// <summary>Enumerates print scaling behaviors.</summary>
103108
[NoiOS]
104-
#elif IOS
105-
[Obsolete (Constants.UnavailableOniOS)]
106-
#endif
109+
[NoTV]
107110
[Unavailable (PlatformName.MacCatalyst)]
108111
[Native]
109112
public enum PdfPrintScalingMode : long {
@@ -113,13 +116,15 @@ public enum PdfPrintScalingMode : long {
113116
}
114117

115118
[Native]
119+
[TV (18, 2)]
116120
public enum PdfDocumentPermissions : long {
117121
None = 0,
118122
User = 1,
119123
Owner = 2
120124
}
121125

122126
[Native]
127+
[TV (18, 2)]
123128
public enum PdfDisplayBox : long {
124129
Media = 0,
125130
Crop = 1,
@@ -129,6 +134,7 @@ public enum PdfDisplayBox : long {
129134
}
130135

131136
[Native]
137+
[TV (18, 2)]
132138
public enum PdfDisplayMode : long {
133139
SinglePage = 0,
134140
SinglePageContinuous = 1,
@@ -138,6 +144,7 @@ public enum PdfDisplayMode : long {
138144

139145
[Flags]
140146
[Native]
147+
[TV (18, 2)]
141148
public enum PdfAreaOfInterest : long {
142149
NoArea = 0,
143150
PageArea = 1 << 0,
@@ -154,12 +161,14 @@ public enum PdfAreaOfInterest : long {
154161
}
155162

156163
[Native]
164+
[TV (18, 2)]
157165
public enum PdfDisplayDirection : long {
158166
Vertical = 0,
159167
Horizontal = 1,
160168
}
161169

162170
[Native]
171+
[TV (18, 2)]
163172
public enum PdfInterpolationQuality : long {
164173
None = 0,
165174
Low = 1,
@@ -168,12 +177,14 @@ public enum PdfInterpolationQuality : long {
168177

169178
[NoMac]
170179
[Native]
180+
[TV (18, 2)]
171181
public enum PdfThumbnailLayoutMode : long {
172182
Vertical = 0,
173183
Horizontal = 1,
174184
}
175185

176186
[Native]
187+
[TV (18, 2)]
177188
public enum PdfWidgetCellState : long {
178189
Mixed = -1,
179190
Off = 0,

src/PdfKit/PdfAnnotation.cs

+4-17
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@
1919
namespace PdfKit {
2020
public partial class PdfAnnotation {
2121

22-
#if NET
2322
[SupportedOSPlatform ("macos")]
2423
[SupportedOSPlatform ("ios")]
2524
[SupportedOSPlatform ("maccatalyst")]
26-
[UnsupportedOSPlatform ("tvos")]
27-
#endif
25+
[SupportedOSPlatform ("tvos18.2")]
2826
public bool SetValue<T> (T value, PdfAnnotationKey key) where T : class, INativeObject
2927
{
3028
if (value is null)
@@ -33,12 +31,10 @@ public bool SetValue<T> (T value, PdfAnnotationKey key) where T : class, INative
3331
return _SetValue (value.Handle, key.GetConstant ()!);
3432
}
3533

36-
#if NET
3734
[SupportedOSPlatform ("macos")]
3835
[SupportedOSPlatform ("ios")]
3936
[SupportedOSPlatform ("maccatalyst")]
40-
[UnsupportedOSPlatform ("tvos")]
41-
#endif
37+
[SupportedOSPlatform ("tvos18.2")]
4238
public bool SetValue (string str, PdfAnnotationKey key)
4339
{
4440
var nstr = CFString.CreateNative (str);
@@ -49,33 +45,24 @@ public bool SetValue (string str, PdfAnnotationKey key)
4945
}
5046
}
5147

52-
#if NET
5348
[SupportedOSPlatform ("macos")]
5449
[SupportedOSPlatform ("ios")]
5550
[SupportedOSPlatform ("maccatalyst")]
56-
[UnsupportedOSPlatform ("tvos")]
57-
#endif
51+
[SupportedOSPlatform ("tvos18.2")]
5852
public T GetValue<T> (PdfAnnotationKey key) where T : class, INativeObject
5953
{
6054
return Runtime.GetINativeObject<T> (_GetValue (key.GetConstant ()!), true)!;
6155
}
6256

6357
public PdfAnnotationKey AnnotationType {
64-
#if NET
6558
get { return PdfAnnotationKeyExtensions.GetValue (Type!); }
6659
set { Type = value.GetConstant ()!; }
67-
#else
68-
get { return PdfAnnotationKeyExtensions.GetValue ((NSString) Type); }
69-
set { Type = value.GetConstant (); }
70-
#endif
7160
}
7261

73-
#if NET
7462
[SupportedOSPlatform ("macos")]
7563
[SupportedOSPlatform ("ios")]
7664
[SupportedOSPlatform ("maccatalyst")]
77-
[UnsupportedOSPlatform ("tvos")]
78-
#endif
65+
[SupportedOSPlatform ("tvos18.2")]
7966
public CGPoint [] QuadrilateralPoints {
8067
get {
8168
return NSArray.ArrayFromHandleFunc<CGPoint> (_QuadrilateralPoints, (v) => {

src/PdfKit/PdfKit.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public nfloat []? DashPattern {
3131
}
3232
}
3333

34-
#if !IOS
34+
#if !IOS && !__TVOS__
3535
partial class PdfAnnotationMarkup {
3636
public CGPoint []? QuadrilateralPoints {
3737
get {
@@ -55,5 +55,5 @@ public CGPoint []? QuadrilateralPoints {
5555
}
5656
}
5757
}
58-
#endif // !IOS
58+
#endif // !IOS && !__TVOS__
5959
}

src/bgen/Extensions/PlatformNameExtensions.cs

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public static bool TryGetPDFKitMap (this PlatformName currentPlatform, [NotNullW
6161
switch (currentPlatform) {
6262
case PlatformName.iOS:
6363
case PlatformName.MacCatalyst:
64+
case PlatformName.TvOS:
6465
pdfKitMap = "PDFKit";
6566
return true;
6667
case PlatformName.MacOSX:

src/build/dotnet/generator-frameworks.g.cs

+1
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ partial class Frameworks {
411411
"NetworkExtension",
412412
"OpenGLES",
413413
"OSLog",
414+
"PdfKit",
414415
"Phase",
415416
"Photos",
416417
"PhotosUI",

src/frameworks.sources

+1
Original file line numberDiff line numberDiff line change
@@ -2422,6 +2422,7 @@ TVOS_FRAMEWORKS = \
24222422
MultipeerConnectivity \
24232423
NetworkExtension \
24242424
OpenGLES \
2425+
PdfKit \
24252426
Phase \
24262427
Photos \
24272428
PhotosUI \

0 commit comments

Comments
 (0)