mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-27 15:54:30 +00:00
30 lines
728 B
Objective-C
30 lines
728 B
Objective-C
//
|
||
// 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
|