Skip to content

Commit cc58637

Browse files
Update to iOS 13, use SF Symbols, fixed deprecations, version bump
1 parent 3264030 commit cc58637

File tree

83 files changed

+586
-549
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+586
-549
lines changed

BFRImageViewController/BFRImageContainerViewController.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ - (void)presentActivityController {
404404
if (activityItem == nil) return;
405405

406406
UIActivityViewController *activityVC;
407-
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
407+
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) {
408408
activityVC = [[UIActivityViewController alloc] initWithActivityItems:@[activityItem] applicationActivities:nil];
409409
[self presentViewController:activityVC animated:YES completion:nil];
410410
} else {
@@ -441,7 +441,7 @@ - (void)retrieveImageFromAsset {
441441
PHImageRequestOptions *reqOptions = [PHImageRequestOptions new];
442442
reqOptions.synchronous = YES;
443443

444-
[[PHImageManager defaultManager] requestImageDataForAsset:self.imgSrc options:reqOptions resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {
444+
[[PHImageManager defaultManager] requestImageDataAndOrientationForAsset:self.imgSrc options:reqOptions resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, CGImagePropertyOrientation orientation, NSDictionary * _Nullable info) {
445445
self.imgLoaded = [UIImage imageWithData:imageData];
446446
[self addImageToScrollView];
447447
}];

BFRImageViewController/BFRImageViewController.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@ - (void)reinitializeUI {
200200

201201
- (void)addChromeToUI {
202202
if (self.enableDoneButton) {
203-
NSBundle *bundle = [NSBundle bundleForClass:[BFRImageViewController class]];
204-
NSString *imagePath = [bundle pathForResource:@"cross" ofType:@"png"];
205-
UIImage *crossImage = [[UIImage alloc] initWithContentsOfFile:imagePath];
203+
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithWeight:UIImageSymbolWeightBold];
204+
UIImage *crossImage = [UIImage systemImageNamed:@"xmark" withConfiguration:config];
206205

207206
self.doneButton = [UIButton buttonWithType:UIButtonTypeCustom];
207+
self.doneButton.tintColor = [UIColor whiteColor];
208208
[self.doneButton setAccessibilityLabel:BFRImageViewerLocalizedStrings(@"imageViewController.closeButton.text", @"Close")];
209209
[self.doneButton setImage:crossImage forState:UIControlStateNormal];
210210
[self.doneButton addTarget:self action:@selector(handleDoneAction) forControlEvents:UIControlEventTouchUpInside];
-393 Bytes
Binary file not shown.
-592 Bytes
Binary file not shown.
-825 Bytes
Binary file not shown.
1.17 MB
Loading

BFRImageViewer.podspec

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "BFRImageViewer"
3-
s.version = "1.2.9"
3+
s.version = "1.3.0"
44
s.summary = "A turnkey solution to display photos and images of all kinds in your app."
55
s.description = <<-DESC
66
The BFRImageViewer is a turnkey solution to present images within your iOS app 🎉!
@@ -13,11 +13,11 @@ Pod::Spec.new do |s|
1313
s.authors = {"Andrew Yates" => "[email protected]",
1414
"Jordan Morgan" => "[email protected]"}
1515
s.social_media_url = "https://twitter.com/bufferdevs"
16-
s.source = { :git => "https://github.com/bufferapp/buffer-ios-image-viewer.git", :tag => '1.2.9' }
16+
s.source = { :git => "https://github.com/bufferapp/buffer-ios-image-viewer.git", :tag => '1.3.0' }
1717
s.source_files = 'Classes', 'BFRImageViewController/**/*.{h,m}'
18-
s.resources = ['BFRImageViewController/**/BFRImageViewerLocalizations.bundle','BFRImageViewController/**/*.{png}']
18+
s.resources = ['BFRImageViewController/**/BFRImageViewerLocalizations.bundle']
1919
s.exclude_files = 'BFRImageViewController/**/lowResImage.png'
20-
s.platform = :ios, '11.0'
20+
s.platform = :ios, '13.0'
2121
s.requires_arc = true
2222
s.frameworks = "UIKit", "Photos"
2323
s.dependency 'PINRemoteImage/iOS', '~> 3.0.0'

BFRImageViewerDemo/BFRImageViewer.xcodeproj/project.pbxproj

+11-21
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,14 @@
88

99
/* Begin PBXBuildFile section */
1010
1702C69A1F86BBFC00104D0B /* BFRImageViewerConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 1702C6991F86BBFC00104D0B /* BFRImageViewerConstants.m */; };
11-
1702C69C1F86C3A400104D0B /* lowResImage.png in Resources */ = {isa = PBXBuildFile; fileRef = 1702C69B1F86C32100104D0B /* lowResImage.png */; };
1211
170BE4FF212DBB2B005703C6 /* BFRImageViewerDownloadProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = 170BE4FE212DBB2B005703C6 /* BFRImageViewerDownloadProgressView.m */; };
1312
171F4AD01E96BE0500F4AF01 /* BFRBackLoadedImageSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 171F4ACF1E96BE0500F4AF01 /* BFRBackLoadedImageSource.m */; };
1413
171F4AD31E96C31400F4AF01 /* FourthViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 171F4AD21E96C31400F4AF01 /* FourthViewController.m */; };
1514
1797CB8E1E81BB4F00D9F729 /* BFRImageTransitionAnimator.m in Sources */ = {isa = PBXBuildFile; fileRef = 1797CB8D1E81BB4F00D9F729 /* BFRImageTransitionAnimator.m */; };
1615
1797CB911E81BBB200D9F729 /* ThirdViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1797CB901E81BBB200D9F729 /* ThirdViewController.m */; };
1716
17C1AAB61D9D6EBF00FF1B67 /* BFRImageViewerLocalizations.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 17C1AAB51D9D6EBF00FF1B67 /* BFRImageViewerLocalizations.bundle */; };
17+
33625B75264D71130003310C /* lowResImage.png in Resources */ = {isa = PBXBuildFile; fileRef = 33625B74264D71130003310C /* lowResImage.png */; };
1818
3D65F036BBCC181E7FD291F7 /* libPods-BFRImageViewer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 76763DB871F085556628E1C6 /* libPods-BFRImageViewer.a */; };
19-
578DFD5B1CB6F17B00BFBD00 /* cross.png in Resources */ = {isa = PBXBuildFile; fileRef = 578DFD581CB6F17B00BFBD00 /* cross.png */; };
20-
578DFD5C1CB6F17B00BFBD00 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 578DFD591CB6F17B00BFBD00 /* [email protected] */; };
21-
578DFD5D1CB6F17B00BFBD00 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 578DFD5A1CB6F17B00BFBD00 /* [email protected] */; };
2219
944B4DB01BFFC0C000B9BF87 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 944B4DAF1BFFC0C000B9BF87 /* main.m */; };
2320
944B4DB31BFFC0C000B9BF87 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 944B4DB21BFFC0C000B9BF87 /* AppDelegate.m */; };
2421
944B4DB61BFFC0C000B9BF87 /* FirstViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 944B4DB51BFFC0C000B9BF87 /* FirstViewController.m */; };
@@ -33,7 +30,6 @@
3330
1264A436520DEA8753316972 /* Pods-BFRImageViewer.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BFRImageViewer.release.xcconfig"; path = "Pods/Target Support Files/Pods-BFRImageViewer/Pods-BFRImageViewer.release.xcconfig"; sourceTree = "<group>"; };
3431
1702C6981F86BBFC00104D0B /* BFRImageViewerConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BFRImageViewerConstants.h; sourceTree = "<group>"; };
3532
1702C6991F86BBFC00104D0B /* BFRImageViewerConstants.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BFRImageViewerConstants.m; sourceTree = "<group>"; };
36-
1702C69B1F86C32100104D0B /* lowResImage.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = lowResImage.png; sourceTree = "<group>"; };
3733
170BE4FD212DBB2B005703C6 /* BFRImageViewerDownloadProgressView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BFRImageViewerDownloadProgressView.h; sourceTree = "<group>"; };
3834
170BE4FE212DBB2B005703C6 /* BFRImageViewerDownloadProgressView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BFRImageViewerDownloadProgressView.m; sourceTree = "<group>"; };
3935
171F4ACE1E96BE0500F4AF01 /* BFRBackLoadedImageSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BFRBackLoadedImageSource.h; sourceTree = "<group>"; };
@@ -46,10 +42,8 @@
4642
1797CB901E81BBB200D9F729 /* ThirdViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ThirdViewController.m; sourceTree = "<group>"; };
4743
17C1AAB51D9D6EBF00FF1B67 /* BFRImageViewerLocalizations.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = BFRImageViewerLocalizations.bundle; sourceTree = "<group>"; };
4844
17C1AAB91D9D702E00FF1B67 /* BFRImageViewerLocalizations.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BFRImageViewerLocalizations.h; sourceTree = "<group>"; };
45+
33625B74264D71130003310C /* lowResImage.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = lowResImage.png; sourceTree = "<group>"; };
4946
3C46F30D2C78F64E6BC23C87 /* Pods-BFRImageViewer.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BFRImageViewer.debug.xcconfig"; path = "Pods/Target Support Files/Pods-BFRImageViewer/Pods-BFRImageViewer.debug.xcconfig"; sourceTree = "<group>"; };
50-
578DFD581CB6F17B00BFBD00 /* cross.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cross.png; sourceTree = "<group>"; };
51-
578DFD591CB6F17B00BFBD00 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
52-
578DFD5A1CB6F17B00BFBD00 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
5347
76763DB871F085556628E1C6 /* libPods-BFRImageViewer.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-BFRImageViewer.a"; sourceTree = BUILT_PRODUCTS_DIR; };
5448
944B4DAB1BFFC0C000B9BF87 /* BFRImageViewer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BFRImageViewer.app; sourceTree = BUILT_PRODUCTS_DIR; };
5549
944B4DAF1BFFC0C000B9BF87 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
@@ -92,10 +86,7 @@
9286
578DFD551CB6E7F400BFBD00 /* Resources */ = {
9387
isa = PBXGroup;
9488
children = (
95-
1702C69B1F86C32100104D0B /* lowResImage.png */,
96-
578DFD581CB6F17B00BFBD00 /* cross.png */,
97-
578DFD591CB6F17B00BFBD00 /* [email protected] */,
98-
578DFD5A1CB6F17B00BFBD00 /* [email protected] */,
89+
33625B74264D71130003310C /* lowResImage.png */,
9990
17C1AAB51D9D6EBF00FF1B67 /* BFRImageViewerLocalizations.bundle */,
10091
);
10192
path = Resources;
@@ -208,7 +199,7 @@
208199
944B4DA31BFFC0C000B9BF87 /* Project object */ = {
209200
isa = PBXProject;
210201
attributes = {
211-
LastUpgradeCheck = 1010;
202+
LastUpgradeCheck = 1250;
212203
ORGANIZATIONNAME = "Andrew Yates";
213204
TargetAttributes = {
214205
944B4DAA1BFFC0C000B9BF87 = {
@@ -240,12 +231,9 @@
240231
isa = PBXResourcesBuildPhase;
241232
buildActionMask = 2147483647;
242233
files = (
243-
1702C69C1F86C3A400104D0B /* lowResImage.png in Resources */,
244-
578DFD5C1CB6F17B00BFBD00 /* [email protected] in Resources */,
245234
944B4DC11BFFC0C000B9BF87 /* LaunchScreen.storyboard in Resources */,
246-
578DFD5D1CB6F17B00BFBD00 /* [email protected] in Resources */,
247-
578DFD5B1CB6F17B00BFBD00 /* cross.png in Resources */,
248235
17C1AAB61D9D6EBF00FF1B67 /* BFRImageViewerLocalizations.bundle in Resources */,
236+
33625B75264D71130003310C /* lowResImage.png in Resources */,
249237
);
250238
runOnlyForDeploymentPostprocessing = 0;
251239
};
@@ -330,6 +318,7 @@
330318
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
331319
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
332320
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
321+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
333322
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
334323
CLANG_WARN_STRICT_PROTOTYPES = YES;
335324
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -354,7 +343,7 @@
354343
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
355344
GCC_WARN_UNUSED_FUNCTION = YES;
356345
GCC_WARN_UNUSED_VARIABLE = YES;
357-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
346+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
358347
MTL_ENABLE_DEBUG_INFO = YES;
359348
ONLY_ACTIVE_ARCH = YES;
360349
SDKROOT = iphoneos;
@@ -385,6 +374,7 @@
385374
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
386375
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
387376
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
377+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
388378
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
389379
CLANG_WARN_STRICT_PROTOTYPES = YES;
390380
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -403,7 +393,7 @@
403393
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
404394
GCC_WARN_UNUSED_FUNCTION = YES;
405395
GCC_WARN_UNUSED_VARIABLE = YES;
406-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
396+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
407397
MTL_ENABLE_DEBUG_INFO = NO;
408398
SDKROOT = iphoneos;
409399
TARGETED_DEVICE_FAMILY = "1,2";
@@ -418,7 +408,7 @@
418408
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
419409
DEVELOPMENT_TEAM = UYDA63C4EC;
420410
INFOPLIST_FILE = BFRImageViewer/Info.plist;
421-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
411+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
422412
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
423413
PRODUCT_BUNDLE_IDENTIFIER = com.buffer.BFRImageViewer;
424414
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -432,7 +422,7 @@
432422
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
433423
DEVELOPMENT_TEAM = UYDA63C4EC;
434424
INFOPLIST_FILE = BFRImageViewer/Info.plist;
435-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
425+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
436426
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
437427
PRODUCT_BUNDLE_IDENTIFIER = com.buffer.BFRImageViewer;
438428
PRODUCT_NAME = "$(TARGET_NAME)";

BFRImageViewerDemo/BFRImageViewer/FifthViewController.m

+1-31
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#import "FifthViewController.h"
1111
#import "BFRImageViewController.h"
1212

13-
@interface FifthViewController () <UIViewControllerPreviewingDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate>
13+
@interface FifthViewController () <UINavigationControllerDelegate, UIImagePickerControllerDelegate>
1414

1515
@end
1616

@@ -28,39 +28,9 @@ - (instancetype) init {
2828

2929
- (void)viewDidLoad {
3030
[super viewDidLoad];
31-
[self check3DTouch];
3231
[self addButtonsToView];
3332
}
3433

35-
#pragma mark - 3D Touch
36-
37-
- (void)check3DTouch {
38-
if ([self.traitCollection respondsToSelector:@selector(forceTouchCapability)] && self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable) {
39-
[self registerForPreviewingWithDelegate:self sourceView:self.view];
40-
}
41-
}
42-
43-
- (UIViewController *)previewingContext:(id<UIViewControllerPreviewing>)previewingContext viewControllerForLocation:(CGPoint)location {
44-
PHAuthorizationStatus status = [PHPhotoLibrary authorizationStatus];
45-
46-
if (status == PHAuthorizationStatusAuthorized) {
47-
return [self imageViewControllerForLivePhotoDisableAutoplay:NO];
48-
} else {
49-
[self showAuthorizationAlertViewControllerAnimated:YES];
50-
return nil;
51-
}
52-
}
53-
54-
- (void)previewingContext:(id<UIViewControllerPreviewing>)previewingContext commitViewController:(UIViewController *)viewControllerToCommit {
55-
[self presentViewController:viewControllerToCommit animated:YES completion:nil];
56-
}
57-
58-
- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
59-
if ([self.traitCollection respondsToSelector:@selector(forceTouchCapability)] && self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable) {
60-
[self check3DTouch];
61-
}
62-
}
63-
6434
#pragma mark - Misc
6535

6636
- (void)addButtonsToView {

BFRImageViewerDemo/BFRImageViewer/FirstViewController.m

+1-23
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#import "FirstViewController.h"
1010
#import "BFRImageViewController.h"
1111

12-
@interface FirstViewController () <UIViewControllerPreviewingDelegate>
12+
@interface FirstViewController ()
1313
@property (strong, nonatomic) NSURL *imgURL;
1414
@end
1515

@@ -28,7 +28,6 @@ - (void)viewDidLoad {
2828
[super viewDidLoad];
2929

3030
[self addImageButtonToView];
31-
[self check3DTouch];
3231

3332
self.imgURL = [NSURL URLWithString:@"https://media0.giphy.com/media/huJmPXfeir5JlpPAx0/200.gif"];
3433
}
@@ -39,27 +38,6 @@ - (void)openImage {
3938
[self presentViewController:imageVC animated:YES completion:nil];
4039
}
4140

42-
#pragma mark - 3D Touch
43-
- (void)check3DTouch {
44-
if ([self.traitCollection respondsToSelector:@selector(forceTouchCapability)] && self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable) {
45-
[self registerForPreviewingWithDelegate:self sourceView:self.view];
46-
}
47-
}
48-
49-
- (UIViewController *)previewingContext:(id<UIViewControllerPreviewing>)previewingContext viewControllerForLocation:(CGPoint)location {
50-
return [[BFRImageViewController alloc] initWithImageSource:@[self.imgURL]];
51-
}
52-
53-
- (void)previewingContext:(id<UIViewControllerPreviewing>)previewingContext commitViewController:(UIViewController *)viewControllerToCommit {
54-
[self presentViewController:viewControllerToCommit animated:YES completion:nil];
55-
}
56-
57-
- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
58-
if ([self.traitCollection respondsToSelector:@selector(forceTouchCapability)] && self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable) {
59-
[self check3DTouch];
60-
}
61-
}
62-
6341
#pragma mark - Misc
6442
- (void)addImageButtonToView {
6543
UIButton *openImageFromURL = [UIButton buttonWithType:UIButtonTypeRoundedRect];

BFRImageViewerDemo/BFRImageViewer/FourthViewController.m

+3-4
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,22 @@ - (void)viewDidLoad {
4646
}
4747

4848
- (void)openImageViewer {
49-
BFRBackLoadedImageSource *backloadedImage = [[BFRBackLoadedImageSource alloc] initWithInitialImage:[UIImage imageNamed:@"lowResImage"] hiResURL:[NSURL URLWithString:@"https://overflow.buffer.com/wp-content/uploads/2016/12/1-hByZ0VpJusdVwpZd-Z4-Zw.png"]];
49+
BFRBackLoadedImageSource *backloadedImage = [[BFRBackLoadedImageSource alloc] initWithInitialImage:[UIImage imageNamed:@"lowResImage"] hiResURL:[NSURL URLWithString:@"https://images.unsplash.com/photo-1620910423680-80b93f872962?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1234&q=80"]];
5050

5151
BFRImageViewController *imageVC = [[BFRImageViewController alloc] initWithImageSource:@[backloadedImage]];
5252
[self presentViewController:imageVC animated:YES completion:nil];
5353
}
5454

5555
- (void)openImageViewerWithCompletionHandler {
56-
BFRBackLoadedImageSource *backloadedImage = [[BFRBackLoadedImageSource alloc] initWithInitialImage:[UIImage imageNamed:@"lowResImage"] hiResURL:[NSURL URLWithString:@"https://overflow.buffer.com/wp-content/uploads/2016/12/1-hByZ0VpJusdVwpZd-Z4-Zw.png"]];
56+
BFRBackLoadedImageSource *backloadedImage = [[BFRBackLoadedImageSource alloc] initWithInitialImage:[UIImage imageNamed:@"lowResImage"] hiResURL:[NSURL URLWithString:@"https://images.unsplash.com/photo-1620910423680-80b93f872962?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1234&q=80"]];
5757

5858
backloadedImage.onCompletion = ^(UIImage * _Nullable img, NSError * _Nullable error) {
5959
UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Download Done" message:[NSString stringWithFormat:@"Finished downloading hi res image.\nImage:%@\nError:%@", img, error] preferredStyle:UIAlertControllerStyleAlert];
6060

6161
UIAlertAction *close = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil];
6262
[alertVC addAction:close];
6363

64-
65-
UIViewController *topController = [UIApplication sharedApplication].keyWindow.rootViewController;
64+
UIViewController *topController = self.view.window.windowScene.windows.firstObject.rootViewController;
6665
while (topController.presentedViewController) {
6766
topController = topController.presentedViewController;
6867
}

0 commit comments

Comments
 (0)