diff --git a/src/MapKit/MKEnums.cs b/src/MapKit/MKEnums.cs index debba695e2..ade7313961 100644 --- a/src/MapKit/MKEnums.cs +++ b/src/MapKit/MKEnums.cs @@ -38,7 +38,9 @@ namespace XamCore.MapKit { Satellite, Hybrid, SatelliteFlyover, - HybridFlyover + HybridFlyover, + [iOS (11,0)][TV (11,0)][Mac (10,13, onlyOn64: true)] + MutedStandard, } // NSUInteger -> MKDistanceFormatter.h @@ -116,6 +118,28 @@ namespace XamCore.MapKit { AndQueries = 0, 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 diff --git a/src/MapKit/MKFeatureDisplayPriority.cs b/src/MapKit/MKFeatureDisplayPriority.cs new file mode 100644 index 0000000000..1b34010970 --- /dev/null +++ b/src/MapKit/MKFeatureDisplayPriority.cs @@ -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 \ No newline at end of file diff --git a/src/frameworks.sources b/src/frameworks.sources index 9dcf176ce3..fabdf0e80c 100644 --- a/src/frameworks.sources +++ b/src/frameworks.sources @@ -879,6 +879,7 @@ MAPKIT_CORE_SOURCES = \ MAPKIT_SOURCES = \ MapKit/MKCircle.cs \ MapKit/MKDirections.cs \ + MapKit/MKFeatureDisplayPriority.cs \ MapKit/MKGeodesicPolyline.cs \ MapKit/MKLocalSearch.cs \ MapKit/MKMapItem.cs \ diff --git a/src/mapkit.cs b/src/mapkit.cs index 4010cc7a73..9cd24b603d 100644 --- a/src/mapkit.cs +++ b/src/mapkit.cs @@ -28,9 +28,14 @@ using UIView=XamCore.AppKit.NSView; using UIEdgeInsets=XamCore.AppKit.NSEdgeInsets; using UIColor=XamCore.AppKit.NSColor; #endif +#if WATCH +// helper for [NoWatch] +using MKMapView=XamCore.Foundation.NSObject; +using MKAnnotationView=XamCore.Foundation.NSObject; +#endif namespace XamCore.MapKit { - + [BaseType (typeof (NSObject))] [Model] [Protocol] @@ -175,7 +180,22 @@ namespace XamCore.MapKit { [Export ("rightCalloutOffset")] CGPoint RightCallpoutOffset { get; set; } #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] @@ -258,7 +278,11 @@ namespace XamCore.MapKit { [Since (6,0)] [TV (9,2)] [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)] MKPlacemark Placemark { get; } @@ -343,6 +367,10 @@ namespace XamCore.MapKit { [iOS (9,0), Mac(10,11)] [NullAllowed] 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 @@ -452,8 +480,21 @@ namespace XamCore.MapKit { #endif [Export ("dequeueReusableAnnotationViewWithIdentifier:")] + [return: NullAllowed] 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:")] [PostGet ("SelectedAnnotations")] #if XAMCORE_2_0 @@ -664,6 +705,17 @@ namespace XamCore.MapKit { #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))] [Model] [Protocol] @@ -764,6 +816,10 @@ namespace XamCore.MapKit { [Since (7,0), Export ("mapViewDidFinishRenderingMap:fullyRendered:"), EventArgs ("MKDidFinishRenderingMap")] 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))] @@ -845,13 +901,14 @@ namespace XamCore.MapKit { #endif // !MONOMAC && !WATCH [Watch (3,0)][TV (10,0)][iOS (10,0)] - [NoMac] + [Mac (10,12, onlyOn64 : true)] [Export ("initWithCoordinate:")] IntPtr Constructor (CLLocationCoordinate2D coordinate); -#if !TVOS && !MONOMAC && XAMCORE_2_0 +#if !TVOS && XAMCORE_2_0 [Watch (3,0)][iOS (10,0)] - [NoTV][NoMac] + [Mac (10,12, onlyOn64 : true)] + [NoTV] [Export ("initWithCoordinate:postalAddress:")] IntPtr Constructor (CLLocationCoordinate2D coordinate, CNPostalAddress postalAddress); #endif @@ -1828,5 +1885,108 @@ namespace XamCore.MapKit { [Export ("setMapItem:")] 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 diff --git a/tests/introspection/ApiCtorInitTest.cs b/tests/introspection/ApiCtorInitTest.cs index f317f14f15..eb1d47e89c 100644 --- a/tests/introspection/ApiCtorInitTest.cs +++ b/tests/introspection/ApiCtorInitTest.cs @@ -326,6 +326,11 @@ namespace Introspection { if (ctor.ToString () == "Void .ctor(String, NSBundle)") return true; break; + case "MKCompassButton": + case "MKScaleView": + case "MKUserTrackingButton": + // Xcode9 added types that are created only from static methods (no init) + return true; #if __TVOS__ case "UISearchBar": // - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER __TVOS_PROHIBITED;