hotpocket/services/apple/macOS (App)/ReplaceAnimator.m

30 lines
921 B
Objective-C

//
// ReplaceAnimator.m
// HotPocket (macOS)
//
// Created by Tomek Wójcik on 20/09/2025.
//
#import "ReplaceAnimator.h"
@implementation ReplaceAnimator
-(void)animatePresentationOfViewController:(NSViewController *)viewController fromViewController:(NSViewController *)fromViewController {
NSView *container = fromViewController.view.superview;
if (container == nil) {
return;
}
[fromViewController.view removeFromSuperview];
[container addSubview:viewController.view];
viewController.view.frame = NSMakeRect(0, 0, viewController.view.frame.size.width, viewController.view.frame.size.height);
viewController.view.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
}
-(void)animateDismissalOfViewController:(NSViewController *)viewController fromViewController:(NSViewController *)fromViewController {
[viewController.view removeFromSuperview];
}
@end