Merge pull request #6844 from dalexsoto/alex-visionkit-xcode11

[VisionKit] Add Xcode 11 Beta 1 - 6 bindings
This commit is contained in:
Alex Soto 2019-08-30 11:19:18 -04:00 коммит произвёл GitHub
Родитель 075fa2b477 5c45c3eb1c
Коммит f933589401
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
9 изменённых файлов: 75 добавлений и 11 удалений

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

@ -141,5 +141,6 @@ namespace MonoTouch {
public const string PencilKitLibrary = "/System/Library/Frameworks/PencilKit.framework/PencilKit";
public const string QuickLookThumbnailingLibrary = "/System/Library/Frameworks/QuickLookThumbnailing.framework/QuickLookThumbnailing";
public const string LinkPresentationLibrary = "/System/Library/Frameworks/LinkPresentation.framework/LinkPresentation";
public const string VisionKitLibrary = "/System/Library/Frameworks/VisionKit.framework/VisionKit";
}
}

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

@ -544,7 +544,7 @@ namespace ObjCRuntime {
{
var map = Runtime.options->RegistrationMap;
for (int i = 0; i < map->full_token_reference_count; i++) {
var ptr = map->full_token_references + (i * IntPtr.Size + 8);
var ptr = map->full_token_references + (i * (IntPtr.Size + 8));
var asm_ptr = Marshal.ReadIntPtr (ptr);
var token = Marshal.ReadInt32 (ptr + IntPtr.Size + 4);
if (token != metadata_token)
@ -555,7 +555,7 @@ namespace ObjCRuntime {
if (!Runtime.StringEquals (asm_ptr, assembly_name))
continue;
return (uint) i;
return ((uint) i << 1) + 1;
}
return uint.MaxValue;

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

@ -1950,6 +1950,7 @@ IOS_FRAMEWORKS = \
VideoToolbox \
VideoSubscriberAccount \
Vision \
VisionKit \
WatchConnectivity \
WatchKit \
WKWebKit \

66
src/visionkit.cs Normal file
Просмотреть файл

@ -0,0 +1,66 @@
//
// VisionKit C# bindings
//
// Authors:
// Alex Soto <alexsoto@microsoft.com>
//
// Copyright 2019 Microsoft Corporation. All rights reserved.
//
using System;
using Foundation;
using ObjCRuntime;
using UIKit;
namespace VisionKit {
[NoWatch, NoTV, NoMac, iOS (13,0)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface VNDocumentCameraScan {
[Export ("pageCount")]
nuint PageCount { get; }
[Export ("imageOfPageAtIndex:")]
UIImage GetImage (nuint pageIndex);
[Export ("title", ArgumentSemantic.Strong)]
string Title { get; }
}
[NoWatch, NoTV, NoMac, iOS (13,0)]
[BaseType (typeof (UIViewController))]
interface VNDocumentCameraViewController {
// Usual inlined ctors for UIViewController are marked as NS_UNAVAILABLE
[Wrap ("WeakDelegate")]
[NullAllowed]
IVNDocumentCameraViewControllerDelegate Delegate { get; set; }
[NullAllowed, Export ("delegate", ArgumentSemantic.Weak)]
NSObject WeakDelegate { get; set; }
[Static]
[Export ("supported")]
bool Supported { [Bind ("isSupported")] get; }
}
interface IVNDocumentCameraViewControllerDelegate { }
[NoWatch, NoTV, NoMac, iOS (13,0)]
[Protocol, Model (AutoGeneratedName = true)]
[BaseType (typeof (NSObject))]
interface VNDocumentCameraViewControllerDelegate {
[Export ("documentCameraViewController:didFinishWithScan:")]
void DidFinish (VNDocumentCameraViewController controller, VNDocumentCameraScan scan);
[Export ("documentCameraViewControllerDidCancel:")]
void DidCancel (VNDocumentCameraViewController controller);
[Export ("documentCameraViewController:didFailWithError:")]
void DidFail (VNDocumentCameraViewController controller, NSError error);
}
}

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

@ -468,6 +468,7 @@ namespace Introspection {
case "GKTurnBasedMatchmakerViewController": // You are meant to use the system provided one
case "UIImagePickerController": // You are meant to use the system provided one
case "UIVideoEditorController": // You are meant to use the system provided one
case "VNDocumentCameraViewController": // Explicitly disabled on the headers
if (ctor.ToString () == $"Void .ctor(System.String, {foundation_namespace}.NSBundle)")
return true;
if (ctor.ToString () == $"Void .ctor(UIKit.UIViewController)")

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

@ -235,6 +235,8 @@ namespace Introspection {
return Runtime.Arch == Arch.SIMULATOR;
case "ICNotificationManagerConfiguration": // This works on device but not on simulator, and docs explicitly says it is user creatable
return Runtime.Arch == Arch.SIMULATOR;
case "VNDocumentCameraViewController": // Name: NSGenericException Reason: Document camera is not available on simulator
return Runtime.Arch == Arch.SIMULATOR;
default:
return base.Skip (type);
}

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

@ -1,9 +0,0 @@
!missing-protocol! VNDocumentCameraViewControllerDelegate not bound
!missing-selector! +VNDocumentCameraViewController::isSupported not bound
!missing-selector! VNDocumentCameraScan::imageOfPageAtIndex: not bound
!missing-selector! VNDocumentCameraScan::pageCount not bound
!missing-selector! VNDocumentCameraScan::title not bound
!missing-selector! VNDocumentCameraViewController::delegate not bound
!missing-selector! VNDocumentCameraViewController::setDelegate: not bound
!missing-type! VNDocumentCameraScan not bound
!missing-type! VNDocumentCameraViewController not bound

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

@ -318,6 +318,7 @@ public class Frameworks : Dictionary <string, Framework>
{ "PencilKit", "PencilKit", 13, 0 },
{ "QuickLookThumbnailing", "QuickLookThumbnailing", 13,0 },
{ "LinkPresentation", "LinkPresentation", 13, 0 },
{ "VisionKit", "VisionKit", 13, 0 },
};
}
return ios_frameworks;

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

@ -147,6 +147,7 @@ SIMLAUNCHER_FRAMEWORKS = \
-weak_framework NaturalLanguage \
-weak_framework Network \
-weak_framework IdentityLookupUI \
-weak_framework VisionKit \
# note: there _was_ no CoreAudioKit.framework or Metal.framework for the simulator (before recent iOS9 betas)
# note 2: there's no GameKit, in iOS 9 (beta 3 at least), you're supposed to reference GameCenter instead (looks fixed in beta 4)