Skip to content

Commit

Permalink
Fix: missing classes on tvOS
Browse files Browse the repository at this point in the history
This is just getting it to launch, not very functional yet
  • Loading branch information
khanhduytran0 committed Apr 15, 2024
1 parent c080c16 commit 7a09762
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Natives/SurfaceViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ - (void)viewDidLoad
[self performSelector:@selector(setupCategory_Navigation)];

if (self.isMacCatalystApp) {
UIHoverGestureRecognizer *hoverGesture = [[UIHoverGestureRecognizer alloc]
UIHoverGestureRecognizer *hoverGesture = [[NSClassFromString(@"UIHoverGestureRecognizer") alloc]
initWithTarget:self action:@selector(surfaceOnHover:)];
[self.surfaceView addGestureRecognizer:hoverGesture];
}
Expand Down Expand Up @@ -176,7 +176,7 @@ - (void)viewDidLoad
[self.touchView addGestureRecognizer:self.scrollPanGesture];

if (!isTVOS) {
[self.touchView addInteraction:[[UIPointerInteraction alloc] initWithDelegate:self]];
[self.touchView addInteraction:[[NSClassFromString(@"UIPointerInteraction") alloc] initWithDelegate:self]];
}

// Virtual mouse
Expand Down Expand Up @@ -732,7 +732,7 @@ - (void)surfaceOnDoubleClick:(UITapGestureRecognizer *)sender {
}
}

- (void)surfaceOnHover:(UIHoverGestureRecognizer *)sender {
- (void)surfaceOnHover:(UIGestureRecognizer *)sender {
if (isGrabbing) return;

CGPoint point = [sender locationInView:self.rootView];
Expand Down Expand Up @@ -816,7 +816,7 @@ - (UIPointerRegion *)pointerInteraction:(UIPointerInteraction *)interaction regi
}

- (UIPointerStyle *)pointerInteraction:(UIPointerInteraction *)interaction styleForRegion:(UIPointerRegion *)region {
return [UIPointerStyle hiddenPointerStyle];
return [NSClassFromString(@"UIPointerStyle") hiddenPointerStyle];
}

#pragma mark - Input view stuff
Expand Down
2 changes: 1 addition & 1 deletion Natives/utils.m
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,6 @@ void setButtonPointerInteraction(UIButton *button) {
button.pointerInteractionEnabled = YES;
button.pointerStyleProvider = ^ UIPointerStyle* (UIButton* button, UIPointerEffect* proposedEffect, UIPointerShape* proposedShape) {
UITargetedPreview *preview = [[UITargetedPreview alloc] initWithView:button];
return [UIPointerStyle styleWithEffect:[UIPointerHighlightEffect effectWithPreview:preview] shape:proposedShape];
return [NSClassFromString(@"UIPointerStyle") styleWithEffect:[NSClassFromString(@"UIPointerHighlightEffect") effectWithPreview:preview] shape:proposedShape];
};
}

0 comments on commit 7a09762

Please sign in to comment.