Skip to content
This repository was archived by the owner on Jun 15, 2024. It is now read-only.

Commit 66bd513

Browse files
committed
fix(*): fix issue with mainScreen no longer a function in Xcode 8
2 parents 515b2ac + 1120723 commit 66bd513

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/plugin.ios.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class PDFView extends common.PDFView {
4848
}
4949

5050
private init() {
51-
this.ios = new UIWebView(UIScreen.mainScreen().bounds);
51+
this.ios = new UIWebView(this.mainScreen.bounds);
5252
this.delegate = PDFViewDelegate.initWithOwner(new WeakRef(this));
5353

5454
this.ios.autoresizingMask =
@@ -57,6 +57,12 @@ export class PDFView extends common.PDFView {
5757

5858
this.ios.scalesPageToFit = true;
5959
}
60+
61+
private get mainScreen() {
62+
return typeof UIScreen.mainScreen === 'function' ?
63+
UIScreen.mainScreen() : // xCode 7 and below
64+
UIScreen.mainScreen; // xCode 8+
65+
}
6066
}
6167

6268
class PDFViewDelegate extends NSObject implements UIWebViewDelegate {
@@ -73,4 +79,4 @@ class PDFViewDelegate extends NSObject implements UIWebViewDelegate {
7379
}
7480

7581
private owner: WeakRef<PDFView>;
76-
}
82+
}

0 commit comments

Comments
 (0)