Skip to content

Commit

Permalink
[BottomNavigation] Add check for existence of UIPointerInteraction to…
Browse files Browse the repository at this point in the history
… prevent iOS 13 beta crashes.

PiperOrigin-RevId: 318481794
  • Loading branch information
bryanoltman authored and material-automation committed Jun 26, 2020
1 parent 87422cf commit 7e25289
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions components/BottomNavigation/src/MDCBottomNavigationBar.m
Original file line number Diff line number Diff line change
Expand Up @@ -641,9 +641,13 @@ - (void)setItems:(NSArray<UITabBarItem *> *)items {

#ifdef __IPHONE_13_4
if (@available(iOS 13.4, *)) {
UIPointerInteraction *pointerInteraction =
[[UIPointerInteraction alloc] initWithDelegate:self];
[itemView addInteraction:pointerInteraction];
// Because some iOS 13 betas did not have the UIPointerInteraction class, we need to verify
// that it exists before attempting to use it.
if (NSClassFromString(@"UIPointerInteraction")) {
UIPointerInteraction *pointerInteraction =
[[UIPointerInteraction alloc] initWithDelegate:self];
[itemView addInteraction:pointerInteraction];
}
}
#endif

Expand Down

0 comments on commit 7e25289

Please sign in to comment.