Files
NetNewsWire/iOS/UIKit Extensions/SFSafariViewController+Extras.m

30 lines
728 B
Objective-C
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//
// SFSafariViewController+Extras.m
// NetNewsWire-iOS
//
// Created by Brent Simmons on 11/29/25.
// Copyright © 2025 Ranchero Software. All rights reserved.
//
#import "SFSafariViewController+Extras.h"
@implementation SFSafariViewController (Extras)
/// Safely create an SFSafariViewController.
///
/// Returns nil if it can’t be created due to an exception.
///
/// Reason: <https://github.com/Ranchero-Software/NetNewsWire/issues/4857>
+ (nullable SFSafariViewController *)safeSafariViewController:(NSURL *)url {
@try {
return [[SFSafariViewController alloc] initWithURL:url];
}
@catch (NSException *exception) {
NSLog(@"Failed to create SFSafariViewController: %@", exception);
return nil;
}
}
@end