[Foundation] Move NSAttributedStringDocumentAttributes.ViewSize to shared code.

This property has also been added on macOS (where it didn't exist before), since
both documentation and headers reveal it's available there.
This commit is contained in:
Rolf Bjarne Kvinge 2022-11-23 21:32:06 +01:00
Родитель 40c3b428ec
Коммит 82126c0ed2
2 изменённых файлов: 9 добавлений и 17 удалений

Просмотреть файл

@ -41,23 +41,6 @@ namespace Foundation {
public partial class NSAttributedStringDocumentAttributes : DictionaryContainer {
#if !MONOMAC && !COREBUILD
public CGSize? ViewSize {
get {
NSObject value;
Dictionary.TryGetValue (NSAttributedStringDocumentAttributeKey.NSViewSizeDocumentAttribute, out value);
var size = value as NSValue;
if (size != null)
return size.CGSizeValue;
return null;
}
set {
if (value is null)
RemoveValue (NSAttributedStringDocumentAttributeKey.NSViewSizeDocumentAttribute);
else
Dictionary [NSAttributedStringDocumentAttributeKey.NSViewSizeDocumentAttribute] = NSValue.FromCGSize (value.Value);
}
}
public float? ViewZoom {
get {
return GetFloatValue (NSAttributedStringDocumentAttributeKey.NSViewZoomDocumentAttribute);

Просмотреть файл

@ -157,6 +157,15 @@ namespace Foundation {
}
#endif // !__MACOS__
public CGSize? ViewSize {
get {
return GetCGSizeValue (NSAttributedStringDocumentAttributeKey.NSViewSizeDocumentAttribute);
}
set {
SetCGSizeValue (NSAttributedStringDocumentAttributeKey.NSViewSizeDocumentAttribute, value);
}
}
#if !TVOS && !WATCH
// documentation is unclear if an NSString or an NSUrl should be used...
// but providing an `NSString` throws a `NSInvalidArgumentException Reason: (null) is not a file URL`