[TVMLKit] Work around Apple breaking API for enum values in TVElementUpdateType. (#5849)
* [TVMLKit] Work around Apple breaking API for enum values in TVElementUpdateType. Reference: https://trello.com/c/Eyox7vlH/118-41123682-tvelementupdatetype-enum-values-changed Reference: rdar://41123682 (closed as by design) * Use this workaround even after XAMCORE_4_0. Apple's breaking changes don't disappear in XAMCORE_4_0. * Fix compiler warnings and Export attribute location.
This commit is contained in:
Родитель
8792992b79
Коммит
0e8423e2dd
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using Foundation;
|
||||
using ObjCRuntime;
|
||||
using UIKit;
|
||||
|
||||
namespace TVMLKit {
|
||||
|
||||
|
@ -16,6 +17,39 @@ namespace TVMLKit {
|
|||
public bool IsDispatched { get; set; }
|
||||
|
||||
public bool IsCancelled { get; set; }
|
||||
#endif
|
||||
}
|
||||
|
||||
public partial class TVViewElement {
|
||||
#if !COREBUILD
|
||||
public virtual TVElementUpdateType UpdateType {
|
||||
[Export ("updateType")]
|
||||
get {
|
||||
var value = _UpdateType;
|
||||
switch ((long) value) {
|
||||
case 2:
|
||||
if (UIDevice.CurrentDevice.CheckSystemVersion (12, 0)) {
|
||||
return TVElementUpdateType.Styles;
|
||||
} else {
|
||||
return TVElementUpdateType.Children;
|
||||
}
|
||||
case 3:
|
||||
if (UIDevice.CurrentDevice.CheckSystemVersion (12, 0)) {
|
||||
return TVElementUpdateType.Children;
|
||||
} else {
|
||||
return TVElementUpdateType.Self;
|
||||
}
|
||||
case 4:
|
||||
if (UIDevice.CurrentDevice.CheckSystemVersion (12, 0)) {
|
||||
return TVElementUpdateType.Self;
|
||||
} else {
|
||||
return TVElementUpdateType.Styles;
|
||||
}
|
||||
default:
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,10 +86,17 @@ namespace TVMLKit {
|
|||
public enum TVElementUpdateType : long {
|
||||
None,
|
||||
Subtree,
|
||||
#if XAMCORE_4_0
|
||||
[TV (10,0)]
|
||||
Styles,
|
||||
Children,
|
||||
Self,
|
||||
#else
|
||||
Children,
|
||||
Self,
|
||||
[TV (10,0)]
|
||||
Styles,
|
||||
#endif
|
||||
}
|
||||
|
||||
[TV (9,0)]
|
||||
|
@ -819,8 +826,9 @@ namespace TVMLKit {
|
|||
set;
|
||||
}
|
||||
|
||||
[Internal][Sealed]
|
||||
[Export ("updateType")]
|
||||
TVElementUpdateType UpdateType { get; }
|
||||
TVElementUpdateType _UpdateType { get; }
|
||||
|
||||
[Export ("resetProperty:")]
|
||||
void Reset (TVElementResettableProperty resettableProperty);
|
||||
|
|
Загрузка…
Ссылка в новой задаче