Skip to content

Commit

Permalink
fix(catalyst): Move to newer Preview 14 API breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban committed Feb 21, 2022
1 parent 00144d4 commit 89e70c1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/Uno.UI.Composition/Composition/CoreAnimation.iOSmacOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,13 @@ private void StartAnimation(float from, float to, float delayMilliseconds, float
var discreteAnim = CAKeyFrameAnimation.FromKeyPath(_property);
discreteAnim.KeyTimes = new NSNumber[] {new NSNumber(0.0), new NSNumber(1.0)};
discreteAnim.Values = new NSObject[] {_nsValueConversion(to)};
discreteAnim.CalculationMode = CAKeyFrameAnimation.AnimationDescrete;

discreteAnim.CalculationMode
#if NET6_0_OR_GREATER
= CAKeyFrameAnimation.AnimationDiscrete;
#else
= CAKeyFrameAnimation.AnimationDescrete;
#endif

animation = discreteAnim;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,15 @@ private void ReleaseDisplayLink()
{
if (_isAttachedToLooper)
{
#if __IOS__
//Detach the _displayLink to the MainLoop (uiThread).
#if __IOS__
#if NET6_0_OR_GREATER
_displayLink?.RemoveFromRunLoop(NSRunLoop.Main, NSRunLoopMode.Default);//detaches from the UI thread
_displayLink?.RemoveFromRunLoop(NSRunLoop.Main, NSRunLoopMode.UITracking);
#else
_displayLink?.RemoveFromRunLoop(NSRunLoop.Main, NSRunLoop.NSDefaultRunLoopMode);//detaches from the UI thread
_displayLink?.RemoveFromRunLoop(NSRunLoop.Main, NSRunLoop.UITrackingRunLoopMode);
#endif
_displayLink = null;
#endif
_isAttachedToLooper = false;
Expand Down
5 changes: 5 additions & 0 deletions src/Uno.UI/UI/Xaml/Media/CompositionTarget.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ public static event EventHandler<object> Rendering

if(_handlers.Count == 0)
{
#if NET6_0_OR_GREATER
_displayLink.RemoveFromRunLoop(NSRunLoop.Main, NSRunLoopMode.Default);
_displayLink.RemoveFromRunLoop(NSRunLoop.Main, NSRunLoopMode.UITracking);
#else
_displayLink.RemoveFromRunLoop(NSRunLoop.Main, NSRunLoop.NSDefaultRunLoopMode);
_displayLink.RemoveFromRunLoop(NSRunLoop.Main, NSRunLoop.UITrackingRunLoopMode);
#endif
_displayLink = null;
}
}
Expand Down

0 comments on commit 89e70c1

Please sign in to comment.