[mapkit] Add new bindings up to beta 3 (#2334)

This commit is contained in:
Sebastien Pouliot 2017-07-18 08:50:48 -04:00 коммит произвёл GitHub
Родитель 46ce17507b
Коммит 3bf0305fbb
5 изменённых файлов: 212 добавлений и 6 удалений

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

@ -38,7 +38,9 @@ namespace XamCore.MapKit {
Satellite, Satellite,
Hybrid, Hybrid,
SatelliteFlyover, SatelliteFlyover,
HybridFlyover HybridFlyover,
[iOS (11,0)][TV (11,0)][Mac (10,13, onlyOn64: true)]
MutedStandard,
} }
// NSUInteger -> MKDistanceFormatter.h // NSUInteger -> MKDistanceFormatter.h
@ -116,6 +118,28 @@ namespace XamCore.MapKit {
AndQueries = 0, AndQueries = 0,
Only Only
} }
[TV (11,0)][NoWatch][iOS (11,0)][Mac (10,13, onlyOn64: true)]
[Native]
public enum MKAnnotationViewCollisionMode : nint {
Rectangle,
Circle,
}
[TV (11,0)][NoWatch][iOS (11,0)][NoMac]
[Native]
public enum MKScaleViewAlignment : nint {
Leading,
Trailing,
}
[TV (11,0)][NoWatch][iOS (11,0)][Mac (10,13, onlyOn64: true)]
[Native]
public enum MKFeatureVisibility : nint {
Adaptive,
Hidden,
Visible,
}
} }
#endif #endif

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

@ -0,0 +1,16 @@
#if XAMCORE_2_0 || !MONOMAC
using System;
using XamCore.ObjCRuntime;
namespace XamCore.MapKit {
// .net does not allow float-based enumerations
[TV (11,0)][NoWatch][iOS (11,0)][Mac (10,13, onlyOn64: true)]
public static class MKFeatureDisplayPriority {
public const float Required = 1000f;
public const float DefaultHigh = 750f;
public const float DefaultLow = 250f;
}
}
#endif

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

@ -879,6 +879,7 @@ MAPKIT_CORE_SOURCES = \
MAPKIT_SOURCES = \ MAPKIT_SOURCES = \
MapKit/MKCircle.cs \ MapKit/MKCircle.cs \
MapKit/MKDirections.cs \ MapKit/MKDirections.cs \
MapKit/MKFeatureDisplayPriority.cs \
MapKit/MKGeodesicPolyline.cs \ MapKit/MKGeodesicPolyline.cs \
MapKit/MKLocalSearch.cs \ MapKit/MKLocalSearch.cs \
MapKit/MKMapItem.cs \ MapKit/MKMapItem.cs \

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

@ -28,6 +28,11 @@ using UIView=XamCore.AppKit.NSView;
using UIEdgeInsets=XamCore.AppKit.NSEdgeInsets; using UIEdgeInsets=XamCore.AppKit.NSEdgeInsets;
using UIColor=XamCore.AppKit.NSColor; using UIColor=XamCore.AppKit.NSColor;
#endif #endif
#if WATCH
// helper for [NoWatch]
using MKMapView=XamCore.Foundation.NSObject;
using MKAnnotationView=XamCore.Foundation.NSObject;
#endif
namespace XamCore.MapKit { namespace XamCore.MapKit {
@ -175,7 +180,22 @@ namespace XamCore.MapKit {
[Export ("rightCalloutOffset")] [Export ("rightCalloutOffset")]
CGPoint RightCallpoutOffset { get; set; } CGPoint RightCallpoutOffset { get; set; }
#endif #endif
[TV (11,0)][iOS (11,0)][Mac (10,13, onlyOn64: true)]
[NullAllowed, Export ("clusteringIdentifier")]
string ClusteringIdentifier { get; set; }
[TV (11,0)][iOS (11,0)][Mac (10,13, onlyOn64: true)]
[NullAllowed, Export ("clusterAnnotationView", ArgumentSemantic.Weak)]
MKAnnotationView ClusterAnnotationView { get; }
[TV (11,0)][iOS (11,0)][Mac (10,13, onlyOn64: true)]
[Advice ("Pre-defined constants are available from 'MKFeatureDisplayPriority'.")]
[Export ("displayPriority")]
float DisplayPriority { get; set; }
[TV (11,0)][iOS (11,0)][Mac (10,13, onlyOn64: true)]
[Export ("collisionMode", ArgumentSemantic.Assign)]
MKAnnotationViewCollisionMode CollisionMode { get; set; }
} }
[ThreadSafe] [ThreadSafe]
@ -258,7 +278,11 @@ namespace XamCore.MapKit {
[Since (6,0)] [Since (6,0)]
[TV (9,2)] [TV (9,2)]
[Mac (10,9, onlyOn64 : true)] [Mac (10,9, onlyOn64 : true)]
interface MKMapItem { interface MKMapItem
#if IOS_NOT_BOUND_YET // https://bugzilla.xamarin.com/show_bug.cgi?id=58203
: NSItemProviderReading, NSItemProviderWriting
#endif
{
[Export ("placemark", ArgumentSemantic.Retain)] [Export ("placemark", ArgumentSemantic.Retain)]
MKPlacemark Placemark { get; } MKPlacemark Placemark { get; }
@ -343,6 +367,10 @@ namespace XamCore.MapKit {
[iOS (9,0), Mac(10,11)] [iOS (9,0), Mac(10,11)]
[NullAllowed] [NullAllowed]
NSTimeZone TimeZone { get; set; } NSTimeZone TimeZone { get; set; }
[iOS (11,0)][Mac (10,13)][Mac (10,13, onlyOn64 : true)][Watch (4,0)]
[Field ("MKMapItemTypeIdentifier")]
NSString TypeIdentifier { get; }
} }
#if !WATCH #if !WATCH
@ -452,8 +480,21 @@ namespace XamCore.MapKit {
#endif #endif
[Export ("dequeueReusableAnnotationViewWithIdentifier:")] [Export ("dequeueReusableAnnotationViewWithIdentifier:")]
[return: NullAllowed]
MKAnnotationView DequeueReusableAnnotation (string withViewIdentifier); MKAnnotationView DequeueReusableAnnotation (string withViewIdentifier);
[TV (11,0)][iOS (11,0)][Mac (10,13, onlyOn64: true)]
[Export ("dequeueReusableAnnotationViewWithIdentifier:forAnnotation:")]
MKAnnotationView DequeueReusableAnnotation (string identifier, IMKAnnotation annotation);
[TV (11,0)][iOS (11,0)][Mac (10,13, onlyOn64: true)]
[Export ("registerClass:forAnnotationViewWithReuseIdentifier:")]
void Register ([NullAllowed] Class viewClass, string identifier);
[TV (11,0)][iOS (11,0)][Mac (10,13, onlyOn64: true)]
[Wrap ("Register (viewType == null ? null : new Class (viewType), identifier)")]
void Register ([NullAllowed] Type viewType, string identifier);
[Export ("selectAnnotation:animated:")] [Export ("selectAnnotation:animated:")]
[PostGet ("SelectedAnnotations")] [PostGet ("SelectedAnnotations")]
#if XAMCORE_2_0 #if XAMCORE_2_0
@ -664,6 +705,17 @@ namespace XamCore.MapKit {
#endif #endif
} }
[Static]
[TV (11,0)][iOS (11,0)][Mac (10,13, onlyOn64: true)]
[NoWatch]
interface MKMapViewDefault {
[Field ("MKMapViewDefaultAnnotationViewReuseIdentifier")]
NSString AnnotationViewReuseIdentifier { get; }
[Field ("MKMapViewDefaultClusterAnnotationViewReuseIdentifier")]
NSString ClusterAnnotationViewReuseIdentifier { get; }
}
[BaseType (typeof (NSObject))] [BaseType (typeof (NSObject))]
[Model] [Model]
[Protocol] [Protocol]
@ -764,6 +816,10 @@ namespace XamCore.MapKit {
[Since (7,0), Export ("mapViewDidFinishRenderingMap:fullyRendered:"), EventArgs ("MKDidFinishRenderingMap")] [Since (7,0), Export ("mapViewDidFinishRenderingMap:fullyRendered:"), EventArgs ("MKDidFinishRenderingMap")]
void DidFinishRenderingMap (MKMapView mapView, bool fullyRendered); void DidFinishRenderingMap (MKMapView mapView, bool fullyRendered);
[TV (11,0)][NoWatch][iOS (11,0)][Mac (10,13, onlyOn64: true)]
[Export ("mapView:clusterAnnotationForMemberAnnotations:"), DelegateName ("MKCreateClusterAnnotation"), DefaultValue (null)]
MKClusterAnnotation CreateClusterAnnotation (MKMapView mapView, IMKAnnotation[] memberAnnotations);
} }
[BaseType (typeof (MKAnnotationView))] [BaseType (typeof (MKAnnotationView))]
@ -845,13 +901,14 @@ namespace XamCore.MapKit {
#endif // !MONOMAC && !WATCH #endif // !MONOMAC && !WATCH
[Watch (3,0)][TV (10,0)][iOS (10,0)] [Watch (3,0)][TV (10,0)][iOS (10,0)]
[NoMac] [Mac (10,12, onlyOn64 : true)]
[Export ("initWithCoordinate:")] [Export ("initWithCoordinate:")]
IntPtr Constructor (CLLocationCoordinate2D coordinate); IntPtr Constructor (CLLocationCoordinate2D coordinate);
#if !TVOS && !MONOMAC && XAMCORE_2_0 #if !TVOS && XAMCORE_2_0
[Watch (3,0)][iOS (10,0)] [Watch (3,0)][iOS (10,0)]
[NoTV][NoMac] [Mac (10,12, onlyOn64 : true)]
[NoTV]
[Export ("initWithCoordinate:postalAddress:")] [Export ("initWithCoordinate:postalAddress:")]
IntPtr Constructor (CLLocationCoordinate2D coordinate, CNPostalAddress postalAddress); IntPtr Constructor (CLLocationCoordinate2D coordinate, CNPostalAddress postalAddress);
#endif #endif
@ -1828,5 +1885,108 @@ namespace XamCore.MapKit {
[Export ("setMapItem:")] [Export ("setMapItem:")]
void SetMapItem (MKMapItem item); void SetMapItem (MKMapItem item);
} }
[TV (11,0)][NoWatch][iOS (11,0)][Mac (10,13, onlyOn64: true)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface MKClusterAnnotation : MKAnnotation {
[NullAllowed, Export ("title")]
new string Title { get; set; }
[NullAllowed, Export ("subtitle")]
new string Subtitle { get; set; }
[Export ("memberAnnotations")]
IMKAnnotation[] MemberAnnotations { get; }
[Export ("initWithMemberAnnotations:")]
[DesignatedInitializer]
IntPtr Constructor (IMKAnnotation[] memberAnnotations);
}
[NoTV][iOS (11,0)][NoMac][NoWatch]
[BaseType (typeof (UIView))]
[DisableDefaultCtor]
interface MKCompassButton {
[Static]
[Export ("compassButtonWithMapView:")]
MKCompassButton FromMapView ([NullAllowed] MKMapView mapView);
[NullAllowed, Export ("mapView", ArgumentSemantic.Weak)]
MKMapView MapView { get; set; }
[Export ("compassVisibility", ArgumentSemantic.Assign)]
MKFeatureVisibility CompassVisibility { get; set; }
}
[TV (11,0)][NoWatch][iOS (11,0)][NoMac]
[BaseType (typeof (MKAnnotationView))]
interface MKMarkerAnnotationView {
// inlined from base type
[Export ("initWithAnnotation:reuseIdentifier:")]
[PostGet ("Annotation")]
IntPtr Constructor (IMKAnnotation annotation, [NullAllowed] string reuseIdentifier);
[Export ("titleVisibility", ArgumentSemantic.Assign)]
MKFeatureVisibility TitleVisibility { get; set; }
[Export ("subtitleVisibility", ArgumentSemantic.Assign)]
MKFeatureVisibility SubtitleVisibility { get; set; }
[Appearance]
[NullAllowed, Export ("markerTintColor", ArgumentSemantic.Copy)]
UIColor MarkerTintColor { get; set; }
[Appearance]
[NullAllowed, Export ("glyphTintColor", ArgumentSemantic.Copy)]
UIColor GlyphTintColor { get; set; }
[Appearance]
[NullAllowed, Export ("glyphText")]
string GlyphText { get; set; }
[Appearance]
[NullAllowed, Export ("glyphImage", ArgumentSemantic.Copy)]
UIImage GlyphImage { get; set; }
[Appearance]
[NullAllowed, Export ("selectedGlyphImage", ArgumentSemantic.Copy)]
UIImage SelectedGlyphImage { get; set; }
[Export ("animatesWhenAdded")]
bool AnimatesWhenAdded { get; set; }
}
[TV (11,0)][NoWatch][iOS (11,0)][NoMac]
[BaseType (typeof (UIView))]
[DisableDefaultCtor]
interface MKScaleView {
[Static]
[Export ("scaleViewWithMapView:")]
MKScaleView FromMapView ([NullAllowed] MKMapView mapView);
[NullAllowed, Export ("mapView", ArgumentSemantic.Weak)]
MKMapView MapView { get; set; }
[Export ("scaleVisibility", ArgumentSemantic.Assign)]
MKFeatureVisibility ScaleVisibility { get; set; }
[Export ("legendAlignment", ArgumentSemantic.Assign)]
MKScaleViewAlignment LegendAlignment { get; set; }
}
[NoTV][iOS (11,0)][NoWatch][NoMac]
[BaseType (typeof (UIView))]
[DisableDefaultCtor]
interface MKUserTrackingButton {
[Static]
[Export ("userTrackingButtonWithMapView:")]
MKUserTrackingButton FromMapView ([NullAllowed] MKMapView mapView);
[NullAllowed, Export ("mapView", ArgumentSemantic.Weak)]
MKMapView MapView { get; set; }
}
} }
#endif // XAMCORE_2_0 || !MONOMAC #endif // XAMCORE_2_0 || !MONOMAC

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

@ -326,6 +326,11 @@ namespace Introspection {
if (ctor.ToString () == "Void .ctor(String, NSBundle)") if (ctor.ToString () == "Void .ctor(String, NSBundle)")
return true; return true;
break; break;
case "MKCompassButton":
case "MKScaleView":
case "MKUserTrackingButton":
// Xcode9 added types that are created only from static methods (no init)
return true;
#if __TVOS__ #if __TVOS__
case "UISearchBar": case "UISearchBar":
// - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER __TVOS_PROHIBITED; // - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER __TVOS_PROHIBITED;