diff options
author | Jason Wray <friedbunny@users.noreply.github.com> | 2018-04-27 12:25:49 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-27 12:25:49 -0400 |
commit | c067865e7bcb1f8a8eec483a572fa874e5d15111 (patch) | |
tree | 497d51966568a84de02e63943e32f363bc6fc4ce | |
parent | 1a39d7db483a26cd846c7875f3ccc9d54d5a0982 (diff) | |
download | qtlocation-mapboxgl-c067865e7bcb1f8a8eec483a572fa874e5d15111.tar.gz |
[ios, macos] Update minimum deployment versions to iOS 9, macOS 10.11 (#11776)
* [ios] Remove iOS 8 conditionals
* [ios, macos] Bump pod deployment targets
* [ios, macos] Add changelog entries
* [ios, macos] Update docs
* Remove unnecessary selector-based version checks
* Update SQLite note
* [ios, macos] Replace lightweight generics macros with direct use
Lightweight generics for Foundation collections are available everywhere with the bump to iOS 9 and macOS 10.11.
* Update deprecated macOS method
85 files changed, 377 insertions, 489 deletions
diff --git a/platform/darwin/src/MGLAttributionInfo.mm b/platform/darwin/src/MGLAttributionInfo.mm index 07d10e852b..e8d6a203d0 100644 --- a/platform/darwin/src/MGLAttributionInfo.mm +++ b/platform/darwin/src/MGLAttributionInfo.mm @@ -16,7 +16,7 @@ @implementation MGLAttributionInfo -+ (NS_ARRAY_OF(MGLAttributionInfo *) *)attributionInfosFromHTMLString:(nullable NSString *)htmlString fontSize:(CGFloat)fontSize linkColor:(nullable MGLColor *)linkColor { ++ (NSArray<MGLAttributionInfo *> *)attributionInfosFromHTMLString:(nullable NSString *)htmlString fontSize:(CGFloat)fontSize linkColor:(nullable MGLColor *)linkColor { if (!htmlString) { return @[]; } @@ -112,7 +112,7 @@ return infos; } -+ (NSAttributedString *)attributedStringForAttributionInfos:(NS_ARRAY_OF(MGLAttributionInfo *) *)attributionInfos { ++ (NSAttributedString *)attributedStringForAttributionInfos:(NSArray<MGLAttributionInfo *> *)attributionInfos { NSMutableArray *titles = [NSMutableArray arrayWithCapacity:attributionInfos.count]; for (MGLAttributionInfo *info in attributionInfos) { NSMutableAttributedString *title = info.title.mutableCopy; @@ -259,7 +259,7 @@ } } -- (void)growArrayByAddingAttributionInfosFromArray:(NS_ARRAY_OF(MGLAttributionInfo *) *)infos { +- (void)growArrayByAddingAttributionInfosFromArray:(NSArray<MGLAttributionInfo *> *)infos { for (MGLAttributionInfo *info in infos) { [self growArrayByAddingAttributionInfo:info]; } diff --git a/platform/darwin/src/MGLAttributionInfo_Private.h b/platform/darwin/src/MGLAttributionInfo_Private.h index c639752ac3..85c9ed796f 100644 --- a/platform/darwin/src/MGLAttributionInfo_Private.h +++ b/platform/darwin/src/MGLAttributionInfo_Private.h @@ -16,9 +16,9 @@ NS_ASSUME_NONNULL_BEGIN @param fontSize The default text size in points. @param linkColor The default link color. */ -+ (NS_ARRAY_OF(MGLAttributionInfo *) *)attributionInfosFromHTMLString:(nullable NSString *)htmlString fontSize:(CGFloat)fontSize linkColor:(nullable MGLColor *)linkColor; ++ (NSArray<MGLAttributionInfo *> *)attributionInfosFromHTMLString:(nullable NSString *)htmlString fontSize:(CGFloat)fontSize linkColor:(nullable MGLColor *)linkColor; -+ (NSAttributedString *)attributedStringForAttributionInfos:(NS_ARRAY_OF(MGLAttributionInfo *) *)attributionInfos; ++ (NSAttributedString *)attributedStringForAttributionInfos:(NSArray<MGLAttributionInfo *> *)attributionInfos; /** Returns a copy of the `URL` property modified to account for the given style @@ -58,7 +58,7 @@ NS_ASSUME_NONNULL_BEGIN @param infos An array of info objects to add to the receiver. */ -- (void)growArrayByAddingAttributionInfosFromArray:(NS_ARRAY_OF(MGLAttributionInfo *) *)infos; +- (void)growArrayByAddingAttributionInfosFromArray:(NSArray<MGLAttributionInfo *> *)infos; @end diff --git a/platform/darwin/src/MGLCompassDirectionFormatter.m b/platform/darwin/src/MGLCompassDirectionFormatter.m index 5f0cfae6f7..1ac6a82162 100644 --- a/platform/darwin/src/MGLCompassDirectionFormatter.m +++ b/platform/darwin/src/MGLCompassDirectionFormatter.m @@ -15,8 +15,8 @@ } - (NSString *)stringFromDirection:(CLLocationDirection)direction { - static NS_ARRAY_OF(NSString *) *shortStrings; - static NS_ARRAY_OF(NSString *) *longStrings; + static NSArray<NSString *> *shortStrings; + static NSArray<NSString *> *longStrings; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ shortStrings = @[ diff --git a/platform/darwin/src/MGLComputedShapeSource.h b/platform/darwin/src/MGLComputedShapeSource.h index 068c49245c..7e0037df89 100644 --- a/platform/darwin/src/MGLComputedShapeSource.h +++ b/platform/darwin/src/MGLComputedShapeSource.h @@ -101,7 +101,7 @@ MGL_EXPORT @param identifier A string that uniquely identifies the source. @param options An `NSDictionary` of options for this source. */ -- (instancetype)initWithIdentifier:(NSString *)identifier options:(nullable NS_DICTIONARY_OF(MGLShapeSourceOption, id) *)options NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithIdentifier:(NSString *)identifier options:(nullable NSDictionary<MGLShapeSourceOption, id> *)options NS_DESIGNATED_INITIALIZER; /** Returns a custom shape data source initialized with an identifier, data source, and a @@ -120,7 +120,7 @@ MGL_EXPORT @param identifier A string that uniquely identifies the source. @param options An `NSDictionary` of options for this source. */ -- (instancetype)initWithIdentifier:(NSString *)identifier dataSource:(id<MGLComputedShapeSourceDataSource>)dataSource options:(nullable NS_DICTIONARY_OF(MGLShapeSourceOption, id) *)options; +- (instancetype)initWithIdentifier:(NSString *)identifier dataSource:(id<MGLComputedShapeSourceDataSource>)dataSource options:(nullable NSDictionary<MGLShapeSourceOption, id> *)options; /** Invalidates all the features and properties intersecting with or contained in diff --git a/platform/darwin/src/MGLComputedShapeSource.mm b/platform/darwin/src/MGLComputedShapeSource.mm index fb25eb8eb4..04734d0ef5 100644 --- a/platform/darwin/src/MGLComputedShapeSource.mm +++ b/platform/darwin/src/MGLComputedShapeSource.mm @@ -13,7 +13,7 @@ const MGLShapeSourceOption MGLShapeSourceOptionWrapsCoordinates = @"MGLShapeSourceOptionWrapsCoordinates"; const MGLShapeSourceOption MGLShapeSourceOptionClipsCoordinates = @"MGLShapeSourceOptionClipsCoordinates"; -mbgl::style::CustomGeometrySource::Options MBGLCustomGeometrySourceOptionsFromDictionary(NS_DICTIONARY_OF(MGLShapeSourceOption, id) *options) { +mbgl::style::CustomGeometrySource::Options MBGLCustomGeometrySourceOptionsFromDictionary(NSDictionary<MGLShapeSourceOption, id> *options) { mbgl::style::CustomGeometrySource::Options sourceOptions; if (NSNumber *value = options[MGLShapeSourceOptionMinimumZoomLevel]) { @@ -148,7 +148,7 @@ mbgl::style::CustomGeometrySource::Options MBGLCustomGeometrySourceOptionsFromDi @implementation MGLComputedShapeSource -- (instancetype)initWithIdentifier:(NSString *)identifier options:(NS_DICTIONARY_OF(MGLShapeSourceOption, id) *)options { +- (instancetype)initWithIdentifier:(NSString *)identifier options:(NSDictionary<MGLShapeSourceOption, id> *)options { NSOperationQueue *requestQueue = [[NSOperationQueue alloc] init]; requestQueue.name = [NSString stringWithFormat:@"mgl.MGLComputedShapeSource.%@", identifier]; requestQueue.qualityOfService = NSQualityOfServiceUtility; @@ -176,7 +176,7 @@ mbgl::style::CustomGeometrySource::Options MBGLCustomGeometrySourceOptionsFromDi return self; } -- (instancetype)initWithIdentifier:(NSString *)identifier dataSource:(id<MGLComputedShapeSourceDataSource>)dataSource options:(NS_DICTIONARY_OF(MGLShapeSourceOption, id) *)options { +- (instancetype)initWithIdentifier:(NSString *)identifier dataSource:(id<MGLComputedShapeSourceDataSource>)dataSource options:(NSDictionary<MGLShapeSourceOption, id> *)options { if (self = [self initWithIdentifier:identifier options:options]) { [self setDataSource:dataSource]; } diff --git a/platform/darwin/src/MGLComputedShapeSource_Private.h b/platform/darwin/src/MGLComputedShapeSource_Private.h index e1887caf8d..ec075e4bd7 100644 --- a/platform/darwin/src/MGLComputedShapeSource_Private.h +++ b/platform/darwin/src/MGLComputedShapeSource_Private.h @@ -7,6 +7,6 @@ NS_ASSUME_NONNULL_BEGIN MGL_EXPORT -mbgl::style::CustomGeometrySource::Options MBGLCustomGeometrySourceOptionsFromDictionary(NS_DICTIONARY_OF(MGLShapeSourceOption, id) *options); +mbgl::style::CustomGeometrySource::Options MBGLCustomGeometrySourceOptionsFromDictionary(NSDictionary<MGLShapeSourceOption, id> *options); NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLFeature.h b/platform/darwin/src/MGLFeature.h index d0c9e26062..62471abb16 100644 --- a/platform/darwin/src/MGLFeature.h +++ b/platform/darwin/src/MGLFeature.h @@ -148,7 +148,7 @@ NS_ASSUME_NONNULL_BEGIN when the feature instance is used to initialize an `MGLShapeSource` and that source is added to the map and styled. */ -@property (nonatomic, copy) NS_DICTIONARY_OF(NSString *, id) *attributes; +@property (nonatomic, copy) NSDictionary<NSString *, id> *attributes; /** Returns the feature attribute for the given attribute name. @@ -167,7 +167,7 @@ NS_ASSUME_NONNULL_BEGIN `attributes` property, and an `id` key corresponding to the receiver’s `identifier` property. */ -- (NS_DICTIONARY_OF(NSString *, id) *)geoJSONDictionary; +- (NSDictionary<NSString *, id> *)geoJSONDictionary; @end @@ -252,9 +252,9 @@ MGL_EXPORT MGL_EXPORT @interface MGLShapeCollectionFeature : MGLShapeCollection <MGLFeature> -@property (nonatomic, copy, readonly) NS_ARRAY_OF(MGLShape<MGLFeature> *) *shapes; +@property (nonatomic, copy, readonly) NSArray<MGLShape<MGLFeature> *> *shapes; -+ (instancetype)shapeCollectionWithShapes:(NS_ARRAY_OF(MGLShape<MGLFeature> *) *)shapes; ++ (instancetype)shapeCollectionWithShapes:(NSArray<MGLShape<MGLFeature> *> *)shapes; @end diff --git a/platform/darwin/src/MGLFeature.mm b/platform/darwin/src/MGLFeature.mm index ee2c71be21..02f67dca6e 100644 --- a/platform/darwin/src/MGLFeature.mm +++ b/platform/darwin/src/MGLFeature.mm @@ -233,7 +233,7 @@ MGL_DEFINE_FEATURE_IS_EQUAL(); @dynamic shapes; -+ (instancetype)shapeCollectionWithShapes:(NS_ARRAY_OF(MGLShape<MGLFeature> *) *)shapes { ++ (instancetype)shapeCollectionWithShapes:(NSArray<MGLShape<MGLFeature> *> *)shapes { return [super shapeCollectionWithShapes:shapes]; } @@ -373,7 +373,7 @@ public: } }; -NS_ARRAY_OF(MGLShape <MGLFeature> *) *MGLFeaturesFromMBGLFeatures(const std::vector<mbgl::Feature> &features) { +NSArray<MGLShape <MGLFeature> *> *MGLFeaturesFromMBGLFeatures(const std::vector<mbgl::Feature> &features) { NSMutableArray *shapes = [NSMutableArray arrayWithCapacity:features.size()]; for (const auto &feature : features) { [shapes addObject:MGLFeatureFromMBGLFeature(feature)]; @@ -414,7 +414,7 @@ mbgl::Feature mbglFeature(mbgl::Feature feature, id identifier, NSDictionary *at return feature; } -NS_DICTIONARY_OF(NSString *, id) *NSDictionaryFeatureForGeometry(NSDictionary *geometry, NSDictionary *attributes, id identifier) { +NSDictionary<NSString *, id> *NSDictionaryFeatureForGeometry(NSDictionary *geometry, NSDictionary *attributes, id identifier) { NSMutableDictionary *feature = [@{@"type": @"Feature", @"properties": (attributes) ?: [NSNull null], @"geometry": geometry} mutableCopy]; diff --git a/platform/darwin/src/MGLFeature_Private.h b/platform/darwin/src/MGLFeature_Private.h index 4137200b98..d4074b53ed 100644 --- a/platform/darwin/src/MGLFeature_Private.h +++ b/platform/darwin/src/MGLFeature_Private.h @@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN vector tile features. */ MGL_EXPORT -NS_ARRAY_OF(MGLShape <MGLFeature> *) *MGLFeaturesFromMBGLFeatures(const std::vector<mbgl::Feature> &features); +NSArray<MGLShape <MGLFeature> *> *MGLFeaturesFromMBGLFeatures(const std::vector<mbgl::Feature> &features); /** Returns an `MGLFeature` object converted from the given mbgl::Feature @@ -36,7 +36,7 @@ mbgl::Feature mbglFeature(mbgl::Feature feature, id identifier, NSDictionary *at /** Returns an `NSDictionary` representation of an `MGLFeature`. */ -NS_DICTIONARY_OF(NSString *, id) *NSDictionaryFeatureForGeometry(NSDictionary *geometry, NSDictionary *attributes, id identifier); +NSDictionary<NSString *, id> *NSDictionaryFeatureForGeometry(NSDictionary *geometry, NSDictionary *attributes, id identifier); NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLMapSnapshotter.mm b/platform/darwin/src/MGLMapSnapshotter.mm index 11a5442761..19fa0223a4 100644 --- a/platform/darwin/src/MGLMapSnapshotter.mm +++ b/platform/darwin/src/MGLMapSnapshotter.mm @@ -89,7 +89,7 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64; std::shared_ptr<mbgl::ThreadPool> _mbglThreadPool; std::unique_ptr<mbgl::MapSnapshotter> _mbglMapSnapshotter; std::unique_ptr<mbgl::Actor<mbgl::MapSnapshotter::Callback>> _snapshotCallback; - NS_ARRAY_OF(MGLAttributionInfo *) *_attributionInfo; + NSArray<MGLAttributionInfo *> *_attributionInfo; } diff --git a/platform/darwin/src/MGLMultiPoint.mm b/platform/darwin/src/MGLMultiPoint.mm index 240dad9614..5a7262b0a4 100644 --- a/platform/darwin/src/MGLMultiPoint.mm +++ b/platform/darwin/src/MGLMultiPoint.mm @@ -70,7 +70,7 @@ return _coordinates.size(); } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingPointCount ++ (NSSet<NSString *> *)keyPathsForValuesAffectingPointCount { return [NSSet setWithObjects:@"coordinates", nil]; } diff --git a/platform/darwin/src/MGLOfflineStorage.h b/platform/darwin/src/MGLOfflineStorage.h index a1f3e686c2..ab36592634 100644 --- a/platform/darwin/src/MGLOfflineStorage.h +++ b/platform/darwin/src/MGLOfflineStorage.h @@ -199,7 +199,7 @@ MGL_EXPORT `packs` property, observe KVO change notifications on the `packs` key path. The initial load results in an `NSKeyValueChangeSetting` change. */ -@property (nonatomic, strong, readonly, nullable) NS_ARRAY_OF(MGLOfflinePack *) *packs; +@property (nonatomic, strong, readonly, nullable) NSArray<MGLOfflinePack *> *packs; /** Creates and registers an offline pack that downloads the resources needed to diff --git a/platform/darwin/src/MGLOfflineStorage.mm b/platform/darwin/src/MGLOfflineStorage.mm index 4d999144e8..f4e454534d 100644 --- a/platform/darwin/src/MGLOfflineStorage.mm +++ b/platform/darwin/src/MGLOfflineStorage.mm @@ -32,7 +32,7 @@ const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyMaximumCount = @"Maximu @interface MGLOfflineStorage () -@property (nonatomic, strong, readwrite) NS_MUTABLE_ARRAY_OF(MGLOfflinePack *) *packs; +@property (nonatomic, strong, readwrite) NSMutableArray<MGLOfflinePack *> *packs; @property (nonatomic) mbgl::DefaultFileSource *mbglFileSource; @property (nonatomic, getter=isPaused) BOOL paused; @@ -243,7 +243,7 @@ const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyMaximumCount = @"Maximu _mbglFileSource = nullptr; } -- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NS_DICTIONARY_OF(NSString *, id) *)change context:(void *)context { +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *, id> *)change context:(void *)context { // Synchronize the file source’s access token with the global one in MGLAccountManager. if ([keyPath isEqualToString:@"accessToken"] && object == [MGLAccountManager sharedManager]) { NSString *accessToken = change[NSKeyValueChangeNewKey]; @@ -336,7 +336,7 @@ const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyMaximumCount = @"Maximu } - (void)reloadPacks { - [self getPacksWithCompletionHandler:^(NS_ARRAY_OF(MGLOfflinePack *) *packs, __unused NSError * _Nullable error) { + [self getPacksWithCompletionHandler:^(NSArray<MGLOfflinePack *> *packs, __unused NSError * _Nullable error) { for (MGLOfflinePack *pack in self.packs) { [pack invalidate]; } @@ -344,7 +344,7 @@ const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyMaximumCount = @"Maximu }]; } -- (void)getPacksWithCompletionHandler:(void (^)(NS_ARRAY_OF(MGLOfflinePack *) *packs, NSError * _Nullable error))completion { +- (void)getPacksWithCompletionHandler:(void (^)(NSArray<MGLOfflinePack *> *packs, NSError * _Nullable error))completion { self.mbglFileSource->listOfflineRegions([&, completion](std::exception_ptr exception, mbgl::optional<std::vector<mbgl::OfflineRegion>> regions) { NSError *error; if (exception) { diff --git a/platform/darwin/src/MGLPolygon.h b/platform/darwin/src/MGLPolygon.h index 190b6df9c5..810a8b78ae 100644 --- a/platform/darwin/src/MGLPolygon.h +++ b/platform/darwin/src/MGLPolygon.h @@ -57,7 +57,7 @@ MGL_EXPORT If there are no interior polygons, the value of this property is `nil`. */ -@property (nonatomic, nullable, readonly) NS_ARRAY_OF(MGLPolygon *) *interiorPolygons; +@property (nonatomic, nullable, readonly) NSArray<MGLPolygon *> *interiorPolygons; /** Creates and returns an `MGLPolygon` object from the specified set of @@ -82,7 +82,7 @@ MGL_EXPORT is considered to have no interior polygons. @return A new polygon object. */ -+ (instancetype)polygonWithCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count interiorPolygons:(nullable NS_ARRAY_OF(MGLPolygon *) *)interiorPolygons; ++ (instancetype)polygonWithCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count interiorPolygons:(nullable NSArray<MGLPolygon *> *)interiorPolygons; @end @@ -109,7 +109,7 @@ MGL_EXPORT /** An array of polygons forming the multipolygon. */ -@property (nonatomic, copy, readonly) NS_ARRAY_OF(MGLPolygon *) *polygons; +@property (nonatomic, copy, readonly) NSArray<MGLPolygon *> *polygons; /** Creates and returns a multipolygon object consisting of the given polygons. @@ -117,7 +117,7 @@ MGL_EXPORT @param polygons The array of polygons defining the shape. @return A new multipolygon object. */ -+ (instancetype)multiPolygonWithPolygons:(NS_ARRAY_OF(MGLPolygon *) *)polygons; ++ (instancetype)multiPolygonWithPolygons:(NSArray<MGLPolygon *> *)polygons; @end diff --git a/platform/darwin/src/MGLPolygon.mm b/platform/darwin/src/MGLPolygon.mm index 2af768d514..b80504707b 100644 --- a/platform/darwin/src/MGLPolygon.mm +++ b/platform/darwin/src/MGLPolygon.mm @@ -102,7 +102,7 @@ @"coordinates": self.mgl_coordinates}; } -- (NS_ARRAY_OF(id) *)mgl_coordinates { +- (NSArray<id> *)mgl_coordinates { NSMutableArray *coordinates = [NSMutableArray array]; NSMutableArray *exteriorRing = [NSMutableArray array]; @@ -128,7 +128,7 @@ @interface MGLMultiPolygon () -@property (nonatomic, copy, readwrite) NS_ARRAY_OF(MGLPolygon *) *polygons; +@property (nonatomic, copy, readwrite) NSArray<MGLPolygon *> *polygons; @end @@ -138,11 +138,11 @@ @synthesize overlayBounds = _overlayBounds; -+ (instancetype)multiPolygonWithPolygons:(NS_ARRAY_OF(MGLPolygon *) *)polygons { ++ (instancetype)multiPolygonWithPolygons:(NSArray<MGLPolygon *> *)polygons { return [[self alloc] initWithPolygons:polygons]; } -- (instancetype)initWithPolygons:(NS_ARRAY_OF(MGLPolygon *) *)polygons { +- (instancetype)initWithPolygons:(NSArray<MGLPolygon *> *)polygons { if (self = [super init]) { _polygons = polygons; diff --git a/platform/darwin/src/MGLPolygon_Private.h b/platform/darwin/src/MGLPolygon_Private.h index 75afcd61f6..b006f2d77f 100644 --- a/platform/darwin/src/MGLPolygon_Private.h +++ b/platform/darwin/src/MGLPolygon_Private.h @@ -4,7 +4,7 @@ NS_ASSUME_NONNULL_BEGIN @interface MGLPolygon (Private) -- (NS_ARRAY_OF(id) *)mgl_coordinates; +- (NSArray<id> *)mgl_coordinates; @end diff --git a/platform/darwin/src/MGLPolyline.h b/platform/darwin/src/MGLPolyline.h index b1fca5bf28..8e9007686b 100644 --- a/platform/darwin/src/MGLPolyline.h +++ b/platform/darwin/src/MGLPolyline.h @@ -92,7 +92,7 @@ MGL_EXPORT /** An array of polygons forming the multipolyline. */ -@property (nonatomic, copy, readonly) NS_ARRAY_OF(MGLPolyline *) *polylines; +@property (nonatomic, copy, readonly) NSArray<MGLPolyline *> *polylines; /** Creates and returns a multipolyline object consisting of the given polylines. @@ -100,7 +100,7 @@ MGL_EXPORT @param polylines The array of polylines defining the shape. @return A new multipolyline object. */ -+ (instancetype)multiPolylineWithPolylines:(NS_ARRAY_OF(MGLPolyline *) *)polylines; ++ (instancetype)multiPolylineWithPolylines:(NSArray<MGLPolyline *> *)polylines; @end diff --git a/platform/darwin/src/MGLPolyline.mm b/platform/darwin/src/MGLPolyline.mm index 26e3518cd8..a028db8176 100644 --- a/platform/darwin/src/MGLPolyline.mm +++ b/platform/darwin/src/MGLPolyline.mm @@ -49,7 +49,7 @@ @"coordinates": self.mgl_coordinates}; } -- (NS_ARRAY_OF(id) *)mgl_coordinates { +- (NSArray<id> *)mgl_coordinates { NSMutableArray *coordinates = [[NSMutableArray alloc] initWithCapacity:self.pointCount]; for (NSUInteger index = 0; index < self.pointCount; index++) { CLLocationCoordinate2D coordinate = self.coordinates[index]; @@ -123,7 +123,7 @@ @interface MGLMultiPolyline () -@property (nonatomic, copy, readwrite) NS_ARRAY_OF(MGLPolyline *) *polylines; +@property (nonatomic, copy, readwrite) NSArray<MGLPolyline *> *polylines; @end @@ -133,11 +133,11 @@ @synthesize overlayBounds = _overlayBounds; -+ (instancetype)multiPolylineWithPolylines:(NS_ARRAY_OF(MGLPolyline *) *)polylines { ++ (instancetype)multiPolylineWithPolylines:(NSArray<MGLPolyline *> *)polylines { return [[self alloc] initWithPolylines:polylines]; } -- (instancetype)initWithPolylines:(NS_ARRAY_OF(MGLPolyline *) *)polylines { +- (instancetype)initWithPolylines:(NSArray<MGLPolyline *> *)polylines { if (self = [super init]) { _polylines = polylines; diff --git a/platform/darwin/src/MGLPolyline_Private.h b/platform/darwin/src/MGLPolyline_Private.h index 405a0c5bc9..ff4fabaa78 100644 --- a/platform/darwin/src/MGLPolyline_Private.h +++ b/platform/darwin/src/MGLPolyline_Private.h @@ -4,7 +4,7 @@ NS_ASSUME_NONNULL_BEGIN @interface MGLPolyline (Private) -- (NS_ARRAY_OF(id) *)mgl_coordinates; +- (NSArray<id> *)mgl_coordinates; @end diff --git a/platform/darwin/src/MGLRasterTileSource.h b/platform/darwin/src/MGLRasterTileSource.h index 59b256d5e5..f27cbc285f 100644 --- a/platform/darwin/src/MGLRasterTileSource.h +++ b/platform/darwin/src/MGLRasterTileSource.h @@ -127,7 +127,7 @@ MGL_EXPORT the default values. @return An initialized tile source. */ -- (instancetype)initWithIdentifier:(NSString *)identifier tileURLTemplates:(NS_ARRAY_OF(NSString *) *)tileURLTemplates options:(nullable NS_DICTIONARY_OF(MGLTileSourceOption, id) *)options NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithIdentifier:(NSString *)identifier tileURLTemplates:(NSArray<NSString *> *)tileURLTemplates options:(nullable NSDictionary<MGLTileSourceOption, id> *)options NS_DESIGNATED_INITIALIZER; @end diff --git a/platform/darwin/src/MGLRasterTileSource.mm b/platform/darwin/src/MGLRasterTileSource.mm index 02cfef4ae8..61e9ef97fd 100644 --- a/platform/darwin/src/MGLRasterTileSource.mm +++ b/platform/darwin/src/MGLRasterTileSource.mm @@ -44,7 +44,7 @@ static const CGFloat MGLRasterTileSourceRetinaTileSize = 512; uint16_t(round(tileSize))); } -- (instancetype)initWithIdentifier:(NSString *)identifier tileURLTemplates:(NS_ARRAY_OF(NSString *) *)tileURLTemplates options:(nullable NS_DICTIONARY_OF(MGLTileSourceOption, id) *)options { +- (instancetype)initWithIdentifier:(NSString *)identifier tileURLTemplates:(NSArray<NSString *> *)tileURLTemplates options:(nullable NSDictionary<MGLTileSourceOption, id> *)options { mbgl::Tileset tileSet = MGLTileSetFromTileURLTemplates(tileURLTemplates, options); uint16_t tileSize = MGLRasterTileSourceRetinaTileSize; diff --git a/platform/darwin/src/MGLShapeCollection.h b/platform/darwin/src/MGLShapeCollection.h index bec482ca61..08f3276496 100644 --- a/platform/darwin/src/MGLShapeCollection.h +++ b/platform/darwin/src/MGLShapeCollection.h @@ -40,7 +40,7 @@ MGL_EXPORT /** An array of shapes forming the shape collection. */ -@property (nonatomic, copy, readonly) NS_ARRAY_OF(MGLShape *) *shapes; +@property (nonatomic, copy, readonly) NSArray<MGLShape *> *shapes; /** Creates and returns a shape collection consisting of the given shapes. @@ -49,7 +49,7 @@ MGL_EXPORT this array is copied to the new object. @return A new shape collection object. */ -+ (instancetype)shapeCollectionWithShapes:(NS_ARRAY_OF(MGLShape *) *)shapes; ++ (instancetype)shapeCollectionWithShapes:(NSArray<MGLShape *> *)shapes; @end diff --git a/platform/darwin/src/MGLShapeCollection.mm b/platform/darwin/src/MGLShapeCollection.mm index 03cab0043f..74e78a764a 100644 --- a/platform/darwin/src/MGLShapeCollection.mm +++ b/platform/darwin/src/MGLShapeCollection.mm @@ -6,11 +6,11 @@ @implementation MGLShapeCollection -+ (instancetype)shapeCollectionWithShapes:(NS_ARRAY_OF(MGLShape *) *)shapes { ++ (instancetype)shapeCollectionWithShapes:(NSArray<MGLShape *> *)shapes { return [[self alloc] initWithShapes:shapes]; } -- (instancetype)initWithShapes:(NS_ARRAY_OF(MGLShape *) *)shapes { +- (instancetype)initWithShapes:(NSArray<MGLShape *> *)shapes { if (self = [super init]) { _shapes = shapes.copy; } diff --git a/platform/darwin/src/MGLShapeSource.h b/platform/darwin/src/MGLShapeSource.h index 6fa93476be..1fc00d4de0 100644 --- a/platform/darwin/src/MGLShapeSource.h +++ b/platform/darwin/src/MGLShapeSource.h @@ -154,7 +154,7 @@ MGL_EXPORT @param options An `NSDictionary` of options for this source. @return An initialized shape source. */ -- (instancetype)initWithIdentifier:(NSString *)identifier URL:(NSURL *)url options:(nullable NS_DICTIONARY_OF(MGLShapeSourceOption, id) *)options NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithIdentifier:(NSString *)identifier URL:(NSURL *)url options:(nullable NSDictionary<MGLShapeSourceOption, id> *)options NS_DESIGNATED_INITIALIZER; /** Returns a shape source with an identifier, a shape, and dictionary of options @@ -183,7 +183,7 @@ MGL_EXPORT @param options An `NSDictionary` of options for this source. @return An initialized shape source. */ -- (instancetype)initWithIdentifier:(NSString *)identifier shape:(nullable MGLShape *)shape options:(nullable NS_DICTIONARY_OF(MGLShapeSourceOption, id) *)options NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithIdentifier:(NSString *)identifier shape:(nullable MGLShape *)shape options:(nullable NSDictionary<MGLShapeSourceOption, id> *)options NS_DESIGNATED_INITIALIZER; /** Returns a shape source with an identifier, an array of features, and a dictionary @@ -210,7 +210,7 @@ MGL_EXPORT @param options An `NSDictionary` of options for this source. @return An initialized shape source. */ -- (instancetype)initWithIdentifier:(NSString *)identifier features:(NS_ARRAY_OF(MGLShape<MGLFeature> *) *)features options:(nullable NS_DICTIONARY_OF(MGLShapeSourceOption, id) *)options; +- (instancetype)initWithIdentifier:(NSString *)identifier features:(NSArray<MGLShape<MGLFeature> *> *)features options:(nullable NSDictionary<MGLShapeSourceOption, id> *)options; /** Returns a shape source with an identifier, an array of shapes, and a dictionary of @@ -238,7 +238,7 @@ MGL_EXPORT @param options An `NSDictionary` of options for this source. @return An initialized shape source. */ -- (instancetype)initWithIdentifier:(NSString *)identifier shapes:(NS_ARRAY_OF(MGLShape *) *)shapes options:(nullable NS_DICTIONARY_OF(MGLShapeSourceOption, id) *)options; +- (instancetype)initWithIdentifier:(NSString *)identifier shapes:(NSArray<MGLShape *> *)shapes options:(nullable NSDictionary<MGLShapeSourceOption, id> *)options; #pragma mark Accessing a Source’s Content @@ -291,7 +291,7 @@ MGL_EXPORT @return An array of objects conforming to the `MGLFeature` protocol that represent features in the source that match the predicate. */ -- (NS_ARRAY_OF(id <MGLFeature>) *)featuresMatchingPredicate:(nullable NSPredicate *)predicate; +- (NSArray<id <MGLFeature>> *)featuresMatchingPredicate:(nullable NSPredicate *)predicate; @end diff --git a/platform/darwin/src/MGLShapeSource.mm b/platform/darwin/src/MGLShapeSource.mm index dcc3fd97f5..31e5867703 100644 --- a/platform/darwin/src/MGLShapeSource.mm +++ b/platform/darwin/src/MGLShapeSource.mm @@ -21,7 +21,7 @@ const MGLShapeSourceOption MGLShapeSourceOptionMaximumZoomLevelForClustering = @ const MGLShapeSourceOption MGLShapeSourceOptionMinimumZoomLevel = @"MGLShapeSourceOptionMinimumZoomLevel"; const MGLShapeSourceOption MGLShapeSourceOptionSimplificationTolerance = @"MGLShapeSourceOptionSimplificationTolerance"; -mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NS_DICTIONARY_OF(MGLShapeSourceOption, id) *options) { +mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NSDictionary<MGLShapeSourceOption, id> *options) { auto geoJSONOptions = mbgl::style::GeoJSONOptions(); if (NSNumber *value = options[MGLShapeSourceOptionMinimumZoomLevel]) { @@ -92,7 +92,7 @@ mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NS_DICTIONARY_OF(MGL @implementation MGLShapeSource -- (instancetype)initWithIdentifier:(NSString *)identifier URL:(NSURL *)url options:(NS_DICTIONARY_OF(NSString *, id) *)options { +- (instancetype)initWithIdentifier:(NSString *)identifier URL:(NSURL *)url options:(NSDictionary<NSString *, id> *)options { auto geoJSONOptions = MGLGeoJSONOptionsFromDictionary(options); auto source = std::make_unique<mbgl::style::GeoJSONSource>(identifier.UTF8String, geoJSONOptions); if (self = [super initWithPendingSource:std::move(source)]) { @@ -101,7 +101,7 @@ mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NS_DICTIONARY_OF(MGL return self; } -- (instancetype)initWithIdentifier:(NSString *)identifier shape:(nullable MGLShape *)shape options:(NS_DICTIONARY_OF(MGLShapeSourceOption, id) *)options { +- (instancetype)initWithIdentifier:(NSString *)identifier shape:(nullable MGLShape *)shape options:(NSDictionary<MGLShapeSourceOption, id> *)options { auto geoJSONOptions = MGLGeoJSONOptionsFromDictionary(options); auto source = std::make_unique<mbgl::style::GeoJSONSource>(identifier.UTF8String, geoJSONOptions); if (self = [super initWithPendingSource:std::move(source)]) { @@ -110,7 +110,7 @@ mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NS_DICTIONARY_OF(MGL return self; } -- (instancetype)initWithIdentifier:(NSString *)identifier features:(NS_ARRAY_OF(MGLShape<MGLFeature> *) *)features options:(nullable NS_DICTIONARY_OF(MGLShapeSourceOption, id) *)options { +- (instancetype)initWithIdentifier:(NSString *)identifier features:(NSArray<MGLShape<MGLFeature> *> *)features options:(nullable NSDictionary<MGLShapeSourceOption, id> *)options { for (id <MGLFeature> feature in features) { if (![feature conformsToProtocol:@protocol(MGLFeature)]) { [NSException raise:NSInvalidArgumentException format:@"The object %@ included in the features argument does not conform to the MGLFeature protocol.", feature]; @@ -120,7 +120,7 @@ mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NS_DICTIONARY_OF(MGL return [self initWithIdentifier:identifier shape:shapeCollectionFeature options:options]; } -- (instancetype)initWithIdentifier:(NSString *)identifier shapes:(NS_ARRAY_OF(MGLShape *) *)shapes options:(nullable NS_DICTIONARY_OF(MGLShapeSourceOption, id) *)options { +- (instancetype)initWithIdentifier:(NSString *)identifier shapes:(NSArray<MGLShape *> *)shapes options:(nullable NSDictionary<MGLShapeSourceOption, id> *)options { MGLShapeCollection *shapeCollection = [MGLShapeCollection shapeCollectionWithShapes:shapes]; return [self initWithIdentifier:identifier shape:shapeCollection options:options]; } @@ -153,7 +153,7 @@ mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NS_DICTIONARY_OF(MGL NSStringFromClass([self class]), (void *)self, self.identifier, self.URL, self.shape]; } -- (NS_ARRAY_OF(id <MGLFeature>) *)featuresMatchingPredicate:(nullable NSPredicate *)predicate { +- (NSArray<id <MGLFeature>> *)featuresMatchingPredicate:(nullable NSPredicate *)predicate { mbgl::optional<mbgl::style::Filter> optionalFilter; if (predicate) { diff --git a/platform/darwin/src/MGLShapeSource_Private.h b/platform/darwin/src/MGLShapeSource_Private.h index 0720074d1d..83872afcbc 100644 --- a/platform/darwin/src/MGLShapeSource_Private.h +++ b/platform/darwin/src/MGLShapeSource_Private.h @@ -10,6 +10,6 @@ namespace mbgl { } MGL_EXPORT -mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NS_DICTIONARY_OF(MGLShapeSourceOption, id) *options); +mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NSDictionary<MGLShapeSourceOption, id> *options); NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLStyle.h b/platform/darwin/src/MGLStyle.h index 6df627d7af..814a09ed21 100644 --- a/platform/darwin/src/MGLStyle.h +++ b/platform/darwin/src/MGLStyle.h @@ -241,7 +241,7 @@ MGL_EXPORT /** A set containing the style’s sources. */ -@property (nonatomic, strong) NS_SET_OF(__kindof MGLSource *) *sources; +@property (nonatomic, strong) NSSet<__kindof MGLSource *> *sources; /** Values describing animated transitions to changes on a style's individual @@ -303,7 +303,7 @@ MGL_EXPORT The layers included in the style, arranged according to their back-to-front ordering on the screen. */ -@property (nonatomic, strong) NS_ARRAY_OF(__kindof MGLStyleLayer *) *layers; +@property (nonatomic, strong) NSArray<__kindof MGLStyleLayer *> *layers; /** Returns a style layer with the given identifier in the current style. @@ -417,7 +417,7 @@ MGL_EXPORT #pragma mark Managing Style Classes -@property (nonatomic) NS_ARRAY_OF(NSString *) *styleClasses __attribute__((unavailable("Support for style classes has been removed."))); +@property (nonatomic) NSArray<NSString *> *styleClasses __attribute__((unavailable("Support for style classes has been removed."))); - (BOOL)hasStyleClass:(NSString *)styleClass __attribute__((unavailable("Support for style classes has been removed."))); diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm index 867ac6c451..3f9bfbf8ca 100644 --- a/platform/darwin/src/MGLStyle.mm +++ b/platform/darwin/src/MGLStyle.mm @@ -82,8 +82,8 @@ @property (nonatomic, readonly, weak) MGLMapView *mapView; @property (nonatomic, readonly) mbgl::style::Style *rawStyle; @property (readonly, copy, nullable) NSURL *URL; -@property (nonatomic, readwrite, strong) NS_MUTABLE_DICTIONARY_OF(NSString *, MGLOpenGLStyleLayer *) *openGLLayers; -@property (nonatomic) NS_MUTABLE_DICTIONARY_OF(NSString *, NS_DICTIONARY_OF(NSObject *, MGLTextLanguage *) *) *localizedLayersByIdentifier; +@property (nonatomic, readwrite, strong) NSMutableDictionary<NSString *, MGLOpenGLStyleLayer *> *openGLLayers; +@property (nonatomic) NSMutableDictionary<NSString *, NSDictionary<NSObject *, MGLTextLanguage *> *> *localizedLayersByIdentifier; @end @@ -142,9 +142,9 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, #pragma mark Sources -- (NS_SET_OF(__kindof MGLSource *) *)sources { +- (NSSet<__kindof MGLSource *> *)sources { auto rawSources = self.rawStyle->getSources(); - NS_MUTABLE_SET_OF(__kindof MGLSource *) *sources = [NSMutableSet setWithCapacity:rawSources.size()]; + NSMutableSet<__kindof MGLSource *> *sources = [NSMutableSet setWithCapacity:rawSources.size()]; for (auto rawSource = rawSources.begin(); rawSource != rawSources.end(); ++rawSource) { MGLSource *source = [self sourceFromMBGLSource:*rawSource]; [sources addObject:source]; @@ -152,7 +152,7 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, return sources; } -- (void)setSources:(NS_SET_OF(__kindof MGLSource *) *)sources { +- (void)setSources:(NSSet<__kindof MGLSource *> *)sources { for (MGLSource *source in self.sources) { [self removeSource:source]; } @@ -225,7 +225,7 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, [source removeFromMapView:self.mapView]; } -- (nullable NS_ARRAY_OF(MGLAttributionInfo *) *)attributionInfosWithFontSize:(CGFloat)fontSize linkColor:(nullable MGLColor *)linkColor { +- (nullable NSArray<MGLAttributionInfo *> *)attributionInfosWithFontSize:(CGFloat)fontSize linkColor:(nullable MGLColor *)linkColor { // It’d be incredibly convenient to use -sources here, but this operation // depends on the sources being sorted in ascending order by creation, as // with the std::vector used in mbgl. @@ -245,10 +245,10 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, #pragma mark Style layers -- (NS_ARRAY_OF(__kindof MGLStyleLayer *) *)layers +- (NSArray<__kindof MGLStyleLayer *> *)layers { auto layers = self.rawStyle->getLayers(); - NS_MUTABLE_ARRAY_OF(__kindof MGLStyleLayer *) *styleLayers = [NSMutableArray arrayWithCapacity:layers.size()]; + NSMutableArray<__kindof MGLStyleLayer *> *styleLayers = [NSMutableArray arrayWithCapacity:layers.size()]; for (auto layer : layers) { MGLStyleLayer *styleLayer = [self layerFromMBGLLayer:layer]; [styleLayers addObject:styleLayer]; @@ -256,7 +256,7 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, return styleLayers; } -- (void)setLayers:(NS_ARRAY_OF(__kindof MGLStyleLayer *) *)layers { +- (void)setLayers:(NSArray<__kindof MGLStyleLayer *> *)layers { for (MGLStyleLayer *layer in self.layers) { [self removeLayer:layer]; } @@ -594,13 +594,13 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, } } -- (NS_SET_OF(MGLVectorTileSource *) *)mapboxStreetsSources { +- (NSSet<MGLVectorTileSource *> *)mapboxStreetsSources { return [self.sources objectsPassingTest:^BOOL (__kindof MGLVectorTileSource * _Nonnull source, BOOL * _Nonnull stop) { return [source isKindOfClass:[MGLVectorTileSource class]] && source.mapboxStreets; }]; } -- (NS_ARRAY_OF(MGLStyleLayer *) *)placeStyleLayers { +- (NSArray<MGLStyleLayer *> *)placeStyleLayers { NSSet *streetsSourceIdentifiers = [self.mapboxStreetsSources valueForKey:@"identifier"]; NSSet *placeSourceLayerIdentifiers = [NSSet setWithObjects:@"marine_label", @"country_label", @"state_label", @"place_label", @"water_label", @"poi_label", @"rail_station_label", @"mountain_peak_label", nil]; @@ -610,7 +610,7 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, return [self.layers filteredArrayUsingPredicate:isPlacePredicate]; } -- (NS_ARRAY_OF(MGLStyleLayer *) *)roadStyleLayers { +- (NSArray<MGLStyleLayer *> *)roadStyleLayers { NSSet *streetsSourceIdentifiers = [self.mapboxStreetsSources valueForKey:@"identifier"]; NSPredicate *isPlacePredicate = [NSPredicate predicateWithBlock:^BOOL (MGLVectorStyleLayer * _Nullable layer, NSDictionary<NSString *, id> * _Nullable bindings) { diff --git a/platform/darwin/src/MGLStyle_Private.h b/platform/darwin/src/MGLStyle_Private.h index 24466b8018..1294b9ad1c 100644 --- a/platform/darwin/src/MGLStyle_Private.h +++ b/platform/darwin/src/MGLStyle_Private.h @@ -24,16 +24,16 @@ namespace mbgl { @property (nonatomic, readonly, weak) MGLMapView *mapView; @property (nonatomic, readonly) mbgl::style::Style *rawStyle; -- (nullable NS_ARRAY_OF(MGLAttributionInfo *) *)attributionInfosWithFontSize:(CGFloat)fontSize linkColor:(nullable MGLColor *)linkColor; -@property (nonatomic, readonly, strong) NS_MUTABLE_DICTIONARY_OF(NSString *, MGLOpenGLStyleLayer *) *openGLLayers; -- (void)setStyleClasses:(NS_ARRAY_OF(NSString *) *)appliedClasses transitionDuration:(NSTimeInterval)transitionDuration; +- (nullable NSArray<MGLAttributionInfo *> *)attributionInfosWithFontSize:(CGFloat)fontSize linkColor:(nullable MGLColor *)linkColor; +@property (nonatomic, readonly, strong) NSMutableDictionary<NSString *, MGLOpenGLStyleLayer *> *openGLLayers; +- (void)setStyleClasses:(NSArray<NSString *> *)appliedClasses transitionDuration:(NSTimeInterval)transitionDuration; @end @interface MGLStyle (MGLStreetsAdditions) -@property (nonatomic, readonly, copy) NS_ARRAY_OF(MGLVectorStyleLayer *) *placeStyleLayers; -@property (nonatomic, readonly, copy) NS_ARRAY_OF(MGLVectorStyleLayer *) *roadStyleLayers; +@property (nonatomic, readonly, copy) NSArray<MGLVectorStyleLayer *> *placeStyleLayers; +@property (nonatomic, readonly, copy) NSArray<MGLVectorStyleLayer *> *roadStyleLayers; @end diff --git a/platform/darwin/src/MGLTileSource.h b/platform/darwin/src/MGLTileSource.h index 4bf09026f2..667e1e66ca 100644 --- a/platform/darwin/src/MGLTileSource.h +++ b/platform/darwin/src/MGLTileSource.h @@ -212,7 +212,7 @@ MGL_EXPORT configuration URL, this array is also empty until the configuration JSON file is loaded. */ -@property (nonatomic, copy, readonly) NS_ARRAY_OF(MGLAttributionInfo *) *attributionInfos; +@property (nonatomic, copy, readonly) NSArray<MGLAttributionInfo *> *attributionInfos; @end diff --git a/platform/darwin/src/MGLTileSource.mm b/platform/darwin/src/MGLTileSource.mm index 87ac5be9c2..2fafc6fb51 100644 --- a/platform/darwin/src/MGLTileSource.mm +++ b/platform/darwin/src/MGLTileSource.mm @@ -30,11 +30,11 @@ const MGLTileSourceOption MGLTileSourceOptionDEMEncoding = @"MGLTileSourceOption return nil; } -- (NS_ARRAY_OF(MGLAttributionInfo *) *)attributionInfos { +- (NSArray<MGLAttributionInfo *> *)attributionInfos { return [self attributionInfosWithFontSize:0 linkColor:nil]; } -- (NS_ARRAY_OF(MGLAttributionInfo *) *)attributionInfosWithFontSize:(CGFloat)fontSize linkColor:(nullable MGLColor *)linkColor { +- (NSArray<MGLAttributionInfo *> *)attributionInfosWithFontSize:(CGFloat)fontSize linkColor:(nullable MGLColor *)linkColor { return [MGLAttributionInfo attributionInfosFromHTMLString:self.attributionHTMLString fontSize:fontSize linkColor:linkColor]; @@ -48,7 +48,7 @@ const MGLTileSourceOption MGLTileSourceOptionDEMEncoding = @"MGLTileSourceOption @end -mbgl::Tileset MGLTileSetFromTileURLTemplates(NS_ARRAY_OF(NSString *) *tileURLTemplates, NS_DICTIONARY_OF(MGLTileSourceOption, id) * _Nullable options) { +mbgl::Tileset MGLTileSetFromTileURLTemplates(NSArray<NSString *> *tileURLTemplates, NSDictionary<MGLTileSourceOption, id> * _Nullable options) { mbgl::Tileset tileSet; for (NSString *tileURLTemplate in tileURLTemplates) { diff --git a/platform/darwin/src/MGLTileSource_Private.h b/platform/darwin/src/MGLTileSource_Private.h index 0d9876d412..1b260ca86a 100644 --- a/platform/darwin/src/MGLTileSource_Private.h +++ b/platform/darwin/src/MGLTileSource_Private.h @@ -28,11 +28,11 @@ namespace mbgl { @param fontSize The default text size in points, or 0 to use the default. @param linkColor The default link color, or `nil` to use the default. */ -- (NS_ARRAY_OF(MGLAttributionInfo *) *)attributionInfosWithFontSize:(CGFloat)fontSize linkColor:(nullable MGLColor *)linkColor; +- (NSArray<MGLAttributionInfo *> *)attributionInfosWithFontSize:(CGFloat)fontSize linkColor:(nullable MGLColor *)linkColor; @end MGL_EXPORT -mbgl::Tileset MGLTileSetFromTileURLTemplates(NS_ARRAY_OF(NSString *) *tileURLTemplates, NS_DICTIONARY_OF(MGLTileSourceOption, id) * _Nullable options); +mbgl::Tileset MGLTileSetFromTileURLTemplates(NSArray<NSString *> *tileURLTemplates, NSDictionary<MGLTileSourceOption, id> * _Nullable options); NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLTypes.h b/platform/darwin/src/MGLTypes.h index 5c32791c2f..fbc3a43ea2 100644 --- a/platform/darwin/src/MGLTypes.h +++ b/platform/darwin/src/MGLTypes.h @@ -111,23 +111,3 @@ NS_INLINE MGLTransition MGLTransitionMake(NSTimeInterval duration, NSTimeInterva } NS_ASSUME_NONNULL_END - -#ifndef NS_ARRAY_OF - // Foundation collection classes adopted lightweight generics in iOS 9.0 and OS X 10.11 SDKs. - #if __has_feature(objc_generics) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 90000 || __MAC_OS_X_VERSION_MAX_ALLOWED >= 101100) - /** Inserts a type specifier for a pointer to a lightweight generic with the given collection and object classes. Use a `*` for any non-`id` object classes but no `*` for the collection class. */ - #define NS_ARRAY_OF(ObjectClass...) NSArray <ObjectClass> - #define NS_MUTABLE_ARRAY_OF(ObjectClass...) NSMutableArray <ObjectClass> - #define NS_SET_OF(ObjectClass...) NSSet <ObjectClass> - #define NS_MUTABLE_SET_OF(ObjectClass...) NSMutableSet <ObjectClass> - #define NS_DICTIONARY_OF(ObjectClass...) NSDictionary <ObjectClass> - #define NS_MUTABLE_DICTIONARY_OF(ObjectClass...) NSMutableDictionary <ObjectClass> - #else - #define NS_ARRAY_OF(ObjectClass...) NSArray - #define NS_MUTABLE_ARRAY_OF(ObjectClass...) NSMutableArray - #define NS_SET_OF(ObjectClass...) NSSet - #define NS_MUTABLE_SET_OF(ObjectClass...) NSMutableSet - #define NS_DICTIONARY_OF(ObjectClass...) NSDictionary - #define NS_MUTABLE_DICTIONARY_OF(ObjectClass...) NSMutableDictionary - #endif -#endif diff --git a/platform/darwin/src/MGLVectorTileSource.h b/platform/darwin/src/MGLVectorTileSource.h index 790c9d4d42..70d2f6e8ec 100644 --- a/platform/darwin/src/MGLVectorTileSource.h +++ b/platform/darwin/src/MGLVectorTileSource.h @@ -99,7 +99,7 @@ MGL_EXPORT the default values. @return An initialized tile source. */ -- (instancetype)initWithIdentifier:(NSString *)identifier tileURLTemplates:(NS_ARRAY_OF(NSString *) *)tileURLTemplates options:(nullable NS_DICTIONARY_OF(MGLTileSourceOption, id) *)options NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithIdentifier:(NSString *)identifier tileURLTemplates:(NSArray<NSString *> *)tileURLTemplates options:(nullable NSDictionary<MGLTileSourceOption, id> *)options NS_DESIGNATED_INITIALIZER; #pragma mark Accessing a Source’s Content @@ -138,7 +138,7 @@ MGL_EXPORT @return An array of objects conforming to the `MGLFeature` protocol that represent features loaded by the source that match the predicate. */ -- (NS_ARRAY_OF(id <MGLFeature>) *)featuresInSourceLayersWithIdentifiers:(NS_SET_OF(NSString *) *)sourceLayerIdentifiers predicate:(nullable NSPredicate *)predicate NS_SWIFT_NAME(features(sourceLayerIdentifiers:predicate:)); +- (NSArray<id <MGLFeature>> *)featuresInSourceLayersWithIdentifiers:(NSSet<NSString *> *)sourceLayerIdentifiers predicate:(nullable NSPredicate *)predicate NS_SWIFT_NAME(features(sourceLayerIdentifiers:predicate:)); @end diff --git a/platform/darwin/src/MGLVectorTileSource.mm b/platform/darwin/src/MGLVectorTileSource.mm index c1f7267e4a..c6715d1759 100644 --- a/platform/darwin/src/MGLVectorTileSource.mm +++ b/platform/darwin/src/MGLVectorTileSource.mm @@ -27,7 +27,7 @@ return self = [super initWithPendingSource:std::move(source)]; } -- (instancetype)initWithIdentifier:(NSString *)identifier tileURLTemplates:(NS_ARRAY_OF(NSString *) *)tileURLTemplates options:(nullable NS_DICTIONARY_OF(MGLTileSourceOption, id) *)options { +- (instancetype)initWithIdentifier:(NSString *)identifier tileURLTemplates:(NSArray<NSString *> *)tileURLTemplates options:(nullable NSDictionary<MGLTileSourceOption, id> *)options { mbgl::Tileset tileSet = MGLTileSetFromTileURLTemplates(tileURLTemplates, options); auto source = std::make_unique<mbgl::style::VectorSource>(identifier.UTF8String, tileSet); return self = [super initWithPendingSource:std::move(source)]; @@ -47,7 +47,7 @@ return attribution ? @(attribution->c_str()) : nil; } -- (NS_ARRAY_OF(id <MGLFeature>) *)featuresInSourceLayersWithIdentifiers:(NS_SET_OF(NSString *) *)sourceLayerIdentifiers predicate:(nullable NSPredicate *)predicate { +- (NSArray<id <MGLFeature>> *)featuresInSourceLayersWithIdentifiers:(NSSet<NSString *> *)sourceLayerIdentifiers predicate:(nullable NSPredicate *)predicate { mbgl::optional<std::vector<std::string>> optionalSourceLayerIDs; if (sourceLayerIdentifiers) { @@ -93,9 +93,9 @@ static NSArray * const MGLMapboxStreetsAlternativeLanguages = @[ @"mul", @"ar", @"de", @"es", @"fr", @"pt", @"ru", @"zh", @"zh-Hans", ]; -+ (NS_SET_OF(NSString *) *)mapboxStreetsLanguages { ++ (NSSet<NSString *> *)mapboxStreetsLanguages { static dispatch_once_t onceToken; - static NS_SET_OF(NSString *) *mapboxStreetsLanguages; + static NSSet<NSString *> *mapboxStreetsLanguages; dispatch_once(&onceToken, ^{ mapboxStreetsLanguages = [NSSet setWithArray:MGLMapboxStreetsLanguages]; }); @@ -135,7 +135,7 @@ static NSArray * const MGLMapboxStreetsAlternativeLanguages = @[ return [identifiers containsObject:@"mapbox.mapbox-streets-v7"] || [identifiers containsObject:@"mapbox.mapbox-streets-v6"]; } -- (NS_DICTIONARY_OF(NSString *, NSString *) *)localizedKeysByKeyForPreferredLanguage:(nullable NSString *)preferredLanguage { +- (NSDictionary<NSString *, NSString *> *)localizedKeysByKeyForPreferredLanguage:(nullable NSString *)preferredLanguage { if (!self.mapboxStreets) { return @{}; } diff --git a/platform/darwin/src/MGLVectorTileSource_Private.h b/platform/darwin/src/MGLVectorTileSource_Private.h index 77521869f1..8042e2cfee 100644 --- a/platform/darwin/src/MGLVectorTileSource_Private.h +++ b/platform/darwin/src/MGLVectorTileSource_Private.h @@ -6,12 +6,12 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly, getter=isMapboxStreets) BOOL mapboxStreets; -+ (NS_SET_OF(NSString *) *)mapboxStreetsLanguages; ++ (NSSet<NSString *> *)mapboxStreetsLanguages; + (nullable NSString *)preferredMapboxStreetsLanguage; + (nullable NSString *)preferredMapboxStreetsLanguageForPreferences:(NSArray<NSString *> *)preferencesArray; -- (NS_DICTIONARY_OF(NSString *, NSString *) *)localizedKeysByKeyForPreferredLanguage:(nullable NSString *)preferredLanguage; +- (NSDictionary<NSString *, NSString *> *)localizedKeysByKeyForPreferredLanguage:(nullable NSString *)preferredLanguage; @end diff --git a/platform/darwin/src/NSBundle+MGLAdditions.h b/platform/darwin/src/NSBundle+MGLAdditions.h index ad5e9d5369..86dc27f22c 100644 --- a/platform/darwin/src/NSBundle+MGLAdditions.h +++ b/platform/darwin/src/NSBundle+MGLAdditions.h @@ -34,7 +34,7 @@ NS_ASSUME_NONNULL_BEGIN + (nullable NSString *)mgl_frameworkBundleIdentifier; -+ (nullable NS_DICTIONARY_OF(NSString *, id) *)mgl_frameworkInfoDictionary; ++ (nullable NSDictionary<NSString *, id> *)mgl_frameworkInfoDictionary; + (nullable NSString *)mgl_applicationBundleIdentifier; diff --git a/platform/darwin/src/NSBundle+MGLAdditions.m b/platform/darwin/src/NSBundle+MGLAdditions.m index f55059324e..37f78963d3 100644 --- a/platform/darwin/src/NSBundle+MGLAdditions.m +++ b/platform/darwin/src/NSBundle+MGLAdditions.m @@ -26,7 +26,7 @@ return self.mgl_frameworkInfoDictionary[@"CFBundleIdentifier"]; } -+ (nullable NS_DICTIONARY_OF(NSString *, id) *)mgl_frameworkInfoDictionary { ++ (nullable NSDictionary<NSString *, id> *)mgl_frameworkInfoDictionary { NSBundle *bundle = self.mgl_frameworkBundle; return bundle.infoDictionary; } diff --git a/platform/darwin/src/NSExpression+MGLAdditions.mm b/platform/darwin/src/NSExpression+MGLAdditions.mm index c82a7dc008..a42a2d276e 100644 --- a/platform/darwin/src/NSExpression+MGLAdditions.mm +++ b/platform/darwin/src/NSExpression+MGLAdditions.mm @@ -403,7 +403,7 @@ static NSArray * const MGLTokenizedFunctions = @[ If no replacements take place, this method returns the original collection. */ -NS_ARRAY_OF(NSExpression *) *MGLCollectionByReplacingTokensWithKeyPaths(NS_ARRAY_OF(NSExpression *) *collection) { +NSArray<NSExpression *> *MGLCollectionByReplacingTokensWithKeyPaths(NSArray<NSExpression *> *collection) { __block NSMutableArray *upgradedCollection; [collection enumerateObjectsUsingBlock:^(NSExpression * _Nonnull item, NSUInteger idx, BOOL * _Nonnull stop) { NSExpression *upgradedItem = item.mgl_expressionByReplacingTokensWithKeyPaths; @@ -424,7 +424,7 @@ NS_ARRAY_OF(NSExpression *) *MGLCollectionByReplacingTokensWithKeyPaths(NS_ARRAY If no replacements take place, this method returns the original stop dictionary. */ -NS_DICTIONARY_OF(NSNumber *, NSExpression *) *MGLStopDictionaryByReplacingTokensWithKeyPaths(NS_DICTIONARY_OF(NSNumber *, NSExpression *) *stops) { +NSDictionary<NSNumber *, NSExpression *> *MGLStopDictionaryByReplacingTokensWithKeyPaths(NSDictionary<NSNumber *, NSExpression *> *stops) { __block NSMutableDictionary *upgradedStops; [stops enumerateKeysAndObjectsUsingBlock:^(id _Nonnull zoomLevel, NSExpression * _Nonnull value, BOOL * _Nonnull stop) { if (![value isKindOfClass:[NSExpression class]]) { @@ -665,11 +665,7 @@ NS_DICTIONARY_OF(NSNumber *, NSExpression *) *MGLStopDictionaryByReplacingTokens } + (instancetype)mgl_expressionForConditional:(nonnull NSPredicate *)conditionPredicate trueExpression:(nonnull NSExpression *)trueExpression falseExpresssion:(nonnull NSExpression *)falseExpression { - if (@available(iOS 9.0, *)) { - return [NSExpression expressionForConditional:conditionPredicate trueExpression:trueExpression falseExpression:falseExpression]; - } else { - return [NSExpression expressionForFunction:@"MGL_IF" arguments:@[[NSExpression expressionWithFormat:@"%@", conditionPredicate], trueExpression, falseExpression]]; - } + return [NSExpression expressionForConditional:conditionPredicate trueExpression:trueExpression falseExpression:falseExpression]; } + (instancetype)mgl_expressionForSteppingExpression:(nonnull NSExpression *)steppingExpression fromExpression:(nonnull NSExpression *)minimumExpression stops:(nonnull NSExpression *)stops { @@ -920,12 +916,10 @@ NSArray *MGLSubexpressionsWithJSONObjects(NSArray *objects) { [arguments addObject:[NSExpression expressionWithMGLJSONObject:argumentObjects[index]]]; } } - - if (@available(iOS 9.0, *)) { - if (arguments.count == 3) { - NSPredicate *conditional = [arguments.firstObject constantValue]; - return [NSExpression expressionForConditional:conditional trueExpression:arguments[1] falseExpression:arguments[2]]; - } + + if (arguments.count == 3) { + NSPredicate *conditional = [arguments.firstObject constantValue]; + return [NSExpression expressionForConditional:conditional trueExpression:arguments[1] falseExpression:arguments[2]]; } return [NSExpression expressionForFunction:@"MGL_IF" arguments:arguments]; } else if ([op isEqualToString:@"match"]) { @@ -1359,7 +1353,7 @@ NSArray *MGLSubexpressionsWithJSONObjects(NSArray *objects) { If no localization takes place, this method returns the original collection. */ -NS_ARRAY_OF(NSExpression *) *MGLLocalizedCollection(NS_ARRAY_OF(NSExpression *) *collection, NSLocale * _Nullable locale) { +NSArray<NSExpression *> *MGLLocalizedCollection(NSArray<NSExpression *> *collection, NSLocale * _Nullable locale) { __block NSMutableArray *localizedCollection; [collection enumerateObjectsUsingBlock:^(NSExpression * _Nonnull item, NSUInteger idx, BOOL * _Nonnull stop) { NSExpression *localizedItem = [item mgl_expressionLocalizedIntoLocale:locale]; @@ -1379,7 +1373,7 @@ NS_ARRAY_OF(NSExpression *) *MGLLocalizedCollection(NS_ARRAY_OF(NSExpression *) If no localization takes place, this method returns the original stop dictionary. */ -NS_DICTIONARY_OF(NSNumber *, NSExpression *) *MGLLocalizedStopDictionary(NS_DICTIONARY_OF(NSNumber *, NSExpression *) *stops, NSLocale * _Nullable locale) { +NSDictionary<NSNumber *, NSExpression *> *MGLLocalizedStopDictionary(NSDictionary<NSNumber *, NSExpression *> *stops, NSLocale * _Nullable locale) { __block NSMutableDictionary *localizedStops; [stops enumerateKeysAndObjectsUsingBlock:^(id _Nonnull zoomLevel, NSExpression * _Nonnull value, BOOL * _Nonnull stop) { if (![value isKindOfClass:[NSExpression class]]) { @@ -1444,16 +1438,14 @@ NS_DICTIONARY_OF(NSNumber *, NSExpression *) *MGLLocalizedStopDictionary(NS_DICT } case NSConditionalExpressionType: { - if (@available(iOS 9.0, *)) { - NSExpression *trueExpression = self.trueExpression; - NSExpression *localizedTrueExpression = [trueExpression mgl_expressionLocalizedIntoLocale:locale]; - NSExpression *falseExpression = self.falseExpression; - NSExpression *localizedFalseExpression = [falseExpression mgl_expressionLocalizedIntoLocale:locale]; - if (localizedTrueExpression != trueExpression || localizedFalseExpression != falseExpression) { - return [NSExpression expressionForConditional:self.predicate - trueExpression:localizedTrueExpression - falseExpression:localizedFalseExpression]; - } + NSExpression *trueExpression = self.trueExpression; + NSExpression *localizedTrueExpression = [trueExpression mgl_expressionLocalizedIntoLocale:locale]; + NSExpression *falseExpression = self.falseExpression; + NSExpression *localizedFalseExpression = [falseExpression mgl_expressionLocalizedIntoLocale:locale]; + if (localizedTrueExpression != trueExpression || localizedFalseExpression != falseExpression) { + return [NSExpression expressionForConditional:self.predicate + trueExpression:localizedTrueExpression + falseExpression:localizedFalseExpression]; } return self; } diff --git a/platform/darwin/src/NSString+MGLAdditions.h b/platform/darwin/src/NSString+MGLAdditions.h index 75c593c10b..4888c7a00f 100644 --- a/platform/darwin/src/NSString+MGLAdditions.h +++ b/platform/darwin/src/NSString+MGLAdditions.h @@ -26,9 +26,6 @@ NS_ASSUME_NONNULL_BEGIN Only supports scripts for languages used by Mapbox Streets. - On iOS 8 or older, this will method will always return the untransliterated - receiver. - @param script The four-letter code representing the name of the script, as specified by ISO 15924. */ diff --git a/platform/darwin/src/NSString+MGLAdditions.m b/platform/darwin/src/NSString+MGLAdditions.m index a61f229511..d645490eb3 100644 --- a/platform/darwin/src/NSString+MGLAdditions.m +++ b/platform/darwin/src/NSString+MGLAdditions.m @@ -17,14 +17,9 @@ - (NSString *)mgl_titleCasedStringWithLocale:(NSLocale *)locale { NSMutableString *string = self.mutableCopy; NSOrthography *orthography; -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 || __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunguarded-availability-new" - if ([NSOrthography respondsToSelector:@selector(defaultOrthographyForLanguage:)]) { + if (@available(iOS 11.0, macOS 10.13.0, *)) { orthography = [NSOrthography defaultOrthographyForLanguage:locale.localeIdentifier]; } -#pragma clang diagnostic pop -#endif [string enumerateLinguisticTagsInRange:string.mgl_wholeRange scheme:NSLinguisticTagSchemeLexicalClass options:0 orthography:orthography usingBlock:^(NSString * _Nonnull tag, NSRange tokenRange, NSRange sentenceRange, BOOL * _Nonnull stop) { NSString *word = [string substringWithRange:tokenRange]; if (word.length > 3 @@ -46,22 +41,18 @@ } - (NSString *)mgl_stringByTransliteratingIntoScript:(NSString *)script { - if (@available(iOS 9.0, *)) { - NSMutableString *string = self.mutableCopy; - NSStringTransform transform; - if ([script isEqualToString:@"Latn"]) { - transform = NSStringTransformToLatin; - } else if ([script isEqualToString:@"Hans"]) { - // No transform available. - } else if ([script isEqualToString:@"Cyrl"]) { - transform = @"Any-Latin; Latin-Cyrillic"; - } else if ([script isEqualToString:@"Arab"]) { - transform = @"Any-Latin; Latin-Arabic"; - } - return transform ? [string stringByApplyingTransform:transform reverse:NO] : string; - } else { - return self; + NSMutableString *string = self.mutableCopy; + NSStringTransform transform; + if ([script isEqualToString:@"Latn"]) { + transform = NSStringTransformToLatin; + } else if ([script isEqualToString:@"Hans"]) { + // No transform available. + } else if ([script isEqualToString:@"Cyrl"]) { + transform = @"Any-Latin; Latin-Cyrillic"; + } else if ([script isEqualToString:@"Arab"]) { + transform = @"Any-Latin; Latin-Arabic"; } + return transform ? [string stringByApplyingTransform:transform reverse:NO] : string; } @end diff --git a/platform/darwin/test/MGLAttributionInfoTests.m b/platform/darwin/test/MGLAttributionInfoTests.m index eccc6ceece..5961b61133 100644 --- a/platform/darwin/test/MGLAttributionInfoTests.m +++ b/platform/darwin/test/MGLAttributionInfoTests.m @@ -17,7 +17,7 @@ @"<a class=\"mapbox-improve-map\" href=\"https://www.mapbox.com/map-feedback/\" target=\"_blank\">Improve this map</a>", }; - NS_MUTABLE_ARRAY_OF(MGLAttributionInfo *) *infos = [NSMutableArray array]; + NSMutableArray<MGLAttributionInfo *> *infos = [NSMutableArray array]; for (NSUInteger i = 0; i < sizeof(htmlStrings) / sizeof(htmlStrings[0]); i++) { NSArray *subinfos = [MGLAttributionInfo attributionInfosFromHTMLString:htmlStrings[i] fontSize:0 @@ -67,7 +67,7 @@ CGFloat fontSize = 72; MGLColor *color = [MGLColor redColor]; - NS_MUTABLE_ARRAY_OF(MGLAttributionInfo *) *infos = [NSMutableArray array]; + NSMutableArray<MGLAttributionInfo *> *infos = [NSMutableArray array]; for (NSUInteger i = 0; i < sizeof(htmlStrings) / sizeof(htmlStrings[0]); i++) { NSArray *subinfos = [MGLAttributionInfo attributionInfosFromHTMLString:htmlStrings[i] fontSize:72 @@ -109,7 +109,7 @@ @"Hello World", }; - NS_MUTABLE_ARRAY_OF(MGLAttributionInfo *) *infos = [NSMutableArray array]; + NSMutableArray<MGLAttributionInfo *> *infos = [NSMutableArray array]; for (NSUInteger i = 0; i < sizeof(htmlStrings) / sizeof(htmlStrings[0]); i++) { NSArray *subinfos = [MGLAttributionInfo attributionInfosFromHTMLString:htmlStrings[i] fontSize:0 diff --git a/platform/darwin/test/MGLCoordinateFormatterTests.m b/platform/darwin/test/MGLCoordinateFormatterTests.m index d693f739ec..ac083fa103 100644 --- a/platform/darwin/test/MGLCoordinateFormatterTests.m +++ b/platform/darwin/test/MGLCoordinateFormatterTests.m @@ -24,12 +24,7 @@ coordinate = CLLocationCoordinate2DMake(38.9131982, -77.0325453144239); XCTAssertEqualObjects([shortFormatter stringFromCoordinate:coordinate], @"38°54′48″N, 77°1′57″W"); XCTAssertEqualObjects([mediumFormatter stringFromCoordinate:coordinate], @"38°54′48″ north, 77°1′57″ west"); - if (@available(iOS 9.0, *)) { - XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"38 degrees, 54 minutes, and 48 seconds north by 77 degrees, 1 minute, and 57 seconds west"); - } else { - // Foundation in iOS 8 does not know how to pluralize coordinates. - XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"38 degree(s), 54 minute(s), and 48 second(s) north by 77 degree(s), 1 minute(s), and 57 second(s) west"); - } + XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"38 degrees, 54 minutes, and 48 seconds north by 77 degrees, 1 minute, and 57 seconds west"); shortFormatter.allowsSeconds = NO; mediumFormatter.allowsSeconds = NO; @@ -38,12 +33,7 @@ coordinate = CLLocationCoordinate2DMake(38.9131982, -77.0325453144239); XCTAssertEqualObjects([shortFormatter stringFromCoordinate:coordinate], @"38°55′N, 77°2′W"); XCTAssertEqualObjects([mediumFormatter stringFromCoordinate:coordinate], @"38°55′ north, 77°2′ west"); - if (@available(iOS 9.0, *)) { - XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"38 degrees and 55 minutes north by 77 degrees and 2 minutes west"); - } else { - // Foundation in iOS 8 does not know how to pluralize coordinates. - XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"38 degree(s) and 55 minute(s) north by 77 degree(s) and 2 minute(s) west"); - } + XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"38 degrees and 55 minutes north by 77 degrees and 2 minutes west"); shortFormatter.allowsMinutes = NO; mediumFormatter.allowsMinutes = NO; @@ -52,12 +42,7 @@ coordinate = CLLocationCoordinate2DMake(38.9131982, -77.0325453144239); XCTAssertEqualObjects([shortFormatter stringFromCoordinate:coordinate], @"39°N, 77°W"); XCTAssertEqualObjects([mediumFormatter stringFromCoordinate:coordinate], @"39° north, 77° west"); - if (@available(iOS 9.0, *)) { - XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"39 degrees north by 77 degrees west"); - } else { - // Foundation in iOS 8 does not know how to pluralize coordinates. - XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"39 degree(s) north by 77 degree(s) west"); - } + XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"39 degrees north by 77 degrees west"); } @end diff --git a/platform/darwin/test/MGLExpressionTests.mm b/platform/darwin/test/MGLExpressionTests.mm index d54e961b00..6d710fdcfe 100644 --- a/platform/darwin/test/MGLExpressionTests.mm +++ b/platform/darwin/test/MGLExpressionTests.mm @@ -757,30 +757,26 @@ using namespace std::string_literals; } - (void)testConditionalExpressionObject { - // This test crashes on iOS 8, which doesn't have `+[NSExpression expressionForConditional:trueExpression:falseExpression:]`. - // https://github.com/mapbox/mapbox-gl-native/issues/11007 - if (@available(iOS 9.0, *)) { - { - NSPredicate *conditional = [NSPredicate predicateWithFormat:@"1 = 2"]; - NSExpression *trueExpression = [NSExpression expressionForConstantValue:@YES]; - NSExpression *falseExpression = [NSExpression expressionForConstantValue:@NO]; - NSExpression *expression = [NSExpression expressionForConditional:conditional trueExpression:trueExpression falseExpression:falseExpression]; - NSArray *jsonExpression = @[@"case", @[@"==", @1, @2], @YES, @NO]; - XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression); - XCTAssertEqualObjects([NSExpression expressionWithFormat:@"TERNARY(1 = 2, TRUE, FALSE)"].mgl_jsonExpressionObject, jsonExpression); - XCTAssertEqualObjects([expression expressionValueWithObject:nil context:nil], @NO); - XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], expression); - } - { - NSExpression *expression = [NSExpression expressionWithFormat:@"TERNARY(0 = 1, TRUE, TERNARY(1 = 2, TRUE, FALSE))"]; - NSArray *jsonExpression = @[@"case", @[@"==", @0, @1], @YES, @[@"==", @1, @2], @YES, @NO]; - XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression); - XCTAssertEqualObjects([expression expressionValueWithObject:nil context:nil], @NO); - expression = [NSExpression expressionWithFormat:@"MGL_IF(%@, TRUE, %@, TRUE, FALSE)", - MGLConstantExpression([NSPredicate predicateWithFormat:@"0 = 1"]), - MGLConstantExpression([NSPredicate predicateWithFormat:@"1 = 2"])]; - XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], expression); - } + { + NSPredicate *conditional = [NSPredicate predicateWithFormat:@"1 = 2"]; + NSExpression *trueExpression = [NSExpression expressionForConstantValue:@YES]; + NSExpression *falseExpression = [NSExpression expressionForConstantValue:@NO]; + NSExpression *expression = [NSExpression expressionForConditional:conditional trueExpression:trueExpression falseExpression:falseExpression]; + NSArray *jsonExpression = @[@"case", @[@"==", @1, @2], @YES, @NO]; + XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression); + XCTAssertEqualObjects([NSExpression expressionWithFormat:@"TERNARY(1 = 2, TRUE, FALSE)"].mgl_jsonExpressionObject, jsonExpression); + XCTAssertEqualObjects([expression expressionValueWithObject:nil context:nil], @NO); + XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], expression); + } + { + NSExpression *expression = [NSExpression expressionWithFormat:@"TERNARY(0 = 1, TRUE, TERNARY(1 = 2, TRUE, FALSE))"]; + NSArray *jsonExpression = @[@"case", @[@"==", @0, @1], @YES, @[@"==", @1, @2], @YES, @NO]; + XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression); + XCTAssertEqualObjects([expression expressionValueWithObject:nil context:nil], @NO); + expression = [NSExpression expressionWithFormat:@"MGL_IF(%@, TRUE, %@, TRUE, FALSE)", + MGLConstantExpression([NSPredicate predicateWithFormat:@"0 = 1"]), + MGLConstantExpression([NSPredicate predicateWithFormat:@"1 = 2"])]; + XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], expression); } { NSExpression *expression = [NSExpression expressionWithFormat:@"MGL_IF(%@, %@, %@)", @@ -791,9 +787,7 @@ using namespace std::string_literals; NSArray *jsonExpression = @[@"case", @[@"==", @1, @2], @YES, @NO]; XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression); XCTAssertEqualObjects(compatibilityExpression.mgl_jsonExpressionObject, jsonExpression); - if (@available(iOS 9.0, *)) { - expression = [NSExpression expressionWithFormat:@"TERNARY(1 = 2, YES, NO)"]; - } + expression = [NSExpression expressionWithFormat:@"TERNARY(1 = 2, YES, NO)"]; XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], expression); XCTAssertEqualObjects([expression expressionValueWithObject:nil context:nil], @NO); } @@ -875,12 +869,7 @@ using namespace std::string_literals; } { NSExpression *expression; - if (@available(iOS 9.0, *)) { - expression = [NSExpression expressionWithFormat:@"TERNARY(key != nil, 1, 0)"]; - } else { - expression = [NSExpression expressionWithFormat:@"MGL_IF(%@, 1, 0)", - MGLConstantExpression([NSPredicate predicateWithFormat:@"key != nil"])]; - } + expression = [NSExpression expressionWithFormat:@"TERNARY(key != nil, 1, 0)"]; NSArray *jsonExpression = @[@"case", @[@"!=", @[@"get", @"key"], [NSNull null]], @1, @0]; XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression); XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], expression); @@ -890,13 +879,7 @@ using namespace std::string_literals; { NSDictionary *dictionary = @{@"key": @"🔑"}; NSExpression *expression; - if (@available(iOS 9.0, *)) { - expression = [NSExpression expressionWithFormat:@"TERNARY(%@.key != nil, 1, 0)", dictionary]; - } else { - NSPredicate *conditional = [NSPredicate predicateWithFormat:@"%@.key != nil", dictionary]; - expression = [NSExpression expressionWithFormat:@"MGL_IF(%@, 1, 0)", - MGLConstantExpression(conditional)]; - } + expression = [NSExpression expressionWithFormat:@"TERNARY(%@.key != nil, 1, 0)", dictionary]; NSArray *jsonExpression = @[@"case", @[@"!=", @[@"get", @"key", @[@"literal", dictionary]], [NSNull null]], @1, @0]; XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression); // The dictionary isn’t equal enough. diff --git a/platform/darwin/test/MGLFeatureTests.mm b/platform/darwin/test/MGLFeatureTests.mm index 14b64be854..d135b018f4 100644 --- a/platform/darwin/test/MGLFeatureTests.mm +++ b/platform/darwin/test/MGLFeatureTests.mm @@ -38,7 +38,7 @@ }; features.push_back(mbgl::Feature { polygon }); - NS_ARRAY_OF(MGLShape <MGLFeature> *) *shapes = MGLFeaturesFromMBGLFeatures(features); + NSArray<MGLShape <MGLFeature> *> *shapes = MGLFeaturesFromMBGLFeatures(features); XCTAssertEqual(shapes.count, 3, @"All features should be converted into shapes"); MGLPointFeature *pointShape = (MGLPointFeature *)shapes[0]; @@ -69,7 +69,7 @@ [NSValue valueWithMGLCoordinate:CLLocationCoordinate2DMake(4, 4)]); XCTAssertEqualObjects([NSValue valueWithMGLCoordinate:polygonCoordinates[3]], [NSValue valueWithMGLCoordinate:CLLocationCoordinate2DMake(4, 1)]); - NS_ARRAY_OF(MGLPolygon *) *interiorPolygons = polygonShape.interiorPolygons; + NSArray<MGLPolygon *> *interiorPolygons = polygonShape.interiorPolygons; XCTAssertEqual(interiorPolygons.count, 1); MGLPolygon *interiorPolygon = interiorPolygons.firstObject; XCTAssertEqual(interiorPolygon.pointCount, 4); @@ -103,7 +103,7 @@ vector.push_back(true); features.push_back(pointFeature); - NS_ARRAY_OF(MGLShape <MGLFeature> *) *shapes = MGLFeaturesFromMBGLFeatures(features); + NSArray<MGLShape <MGLFeature> *> *shapes = MGLFeaturesFromMBGLFeatures(features); XCTAssertEqual(shapes.count, 1, @"All features should be converted into shapes"); MGLShape <MGLFeature> *shape = shapes.firstObject; diff --git a/platform/darwin/test/MGLNSStringAdditionsTests.m b/platform/darwin/test/MGLNSStringAdditionsTests.m index 2a8715d991..a3ee7e3433 100644 --- a/platform/darwin/test/MGLNSStringAdditionsTests.m +++ b/platform/darwin/test/MGLNSStringAdditionsTests.m @@ -40,37 +40,29 @@ } - (void)testTransliteratedString { - if (@available(iOS 9.0, *)) { - XCTAssertEqualObjects([@"Portland" mgl_stringByTransliteratingIntoScript:@"Latn"], @"Portland"); - XCTAssertEqualObjects([@"Portland" mgl_stringByTransliteratingIntoScript:@"Hans"], @"Portland"); - XCTAssertEqualObjects([@"Portland" mgl_stringByTransliteratingIntoScript:@"Cyrl"], @"Портланд"); - XCTAssertEqualObjects([@"Portland" mgl_stringByTransliteratingIntoScript:@"Arab"], @"پُرتلَند"); - XCTAssertEqualObjects([@"Portland" mgl_stringByTransliteratingIntoScript:@"Fake"], @"Portland"); - - XCTAssertEqualObjects([@"北京" mgl_stringByTransliteratingIntoScript:@"Latn"], @"běi jīng"); - XCTAssertEqualObjects([@"北京" mgl_stringByTransliteratingIntoScript:@"Hans"], @"北京"); - XCTAssertEqualObjects([@"北京" mgl_stringByTransliteratingIntoScript:@"Cyrl"], @"бе̌и йӣнг"); - XCTAssertEqualObjects([@"北京" mgl_stringByTransliteratingIntoScript:@"Arab"], @"بِِ̌ جِينگ"); - XCTAssertEqualObjects([@"北京" mgl_stringByTransliteratingIntoScript:@"Fake"], @"北京"); - - XCTAssertEqualObjects([@"Mосква" mgl_stringByTransliteratingIntoScript:@"Latn"], @"Moskva"); - XCTAssertEqualObjects([@"Mосква" mgl_stringByTransliteratingIntoScript:@"Hans"], @"Mосква"); - XCTAssertEqualObjects([@"Mосква" mgl_stringByTransliteratingIntoScript:@"Cyrl"], @"Москва"); - XCTAssertEqualObjects([@"Mосква" mgl_stringByTransliteratingIntoScript:@"Arab"], @"مُسكڤَ"); - XCTAssertEqualObjects([@"Mосква" mgl_stringByTransliteratingIntoScript:@"Fake"], @"Mосква"); - - XCTAssertEqualObjects([@"ロンドン" mgl_stringByTransliteratingIntoScript:@"Latn"], @"rondon"); - XCTAssertEqualObjects([@"ロンドン" mgl_stringByTransliteratingIntoScript:@"Hans"], @"ロンドン"); - XCTAssertEqualObjects([@"ロンドン" mgl_stringByTransliteratingIntoScript:@"Cyrl"], @"рондон"); - XCTAssertEqualObjects([@"ロンドン" mgl_stringByTransliteratingIntoScript:@"Arab"], @"رُندُن"); - XCTAssertEqualObjects([@"ロンドン" mgl_stringByTransliteratingIntoScript:@"Fake"], @"ロンドン"); - } else { - XCTAssertEqualObjects([@"Made-up Place" mgl_stringByTransliteratingIntoScript:@"Latn"], @"Made-up Place"); - XCTAssertEqualObjects([@"Made-up Place" mgl_stringByTransliteratingIntoScript:@"Hans"], @"Made-up Place"); - XCTAssertEqualObjects([@"Made-up Place" mgl_stringByTransliteratingIntoScript:@"Cyrl"], @"Made-up Place"); - XCTAssertEqualObjects([@"Made-up Place" mgl_stringByTransliteratingIntoScript:@"Arab"], @"Made-up Place"); - XCTAssertEqualObjects([@"Made-up Place" mgl_stringByTransliteratingIntoScript:@"Fake"], @"Made-up Place"); - } + XCTAssertEqualObjects([@"Portland" mgl_stringByTransliteratingIntoScript:@"Latn"], @"Portland"); + XCTAssertEqualObjects([@"Portland" mgl_stringByTransliteratingIntoScript:@"Hans"], @"Portland"); + XCTAssertEqualObjects([@"Portland" mgl_stringByTransliteratingIntoScript:@"Cyrl"], @"Портланд"); + XCTAssertEqualObjects([@"Portland" mgl_stringByTransliteratingIntoScript:@"Arab"], @"پُرتلَند"); + XCTAssertEqualObjects([@"Portland" mgl_stringByTransliteratingIntoScript:@"Fake"], @"Portland"); + + XCTAssertEqualObjects([@"北京" mgl_stringByTransliteratingIntoScript:@"Latn"], @"běi jīng"); + XCTAssertEqualObjects([@"北京" mgl_stringByTransliteratingIntoScript:@"Hans"], @"北京"); + XCTAssertEqualObjects([@"北京" mgl_stringByTransliteratingIntoScript:@"Cyrl"], @"бе̌и йӣнг"); + XCTAssertEqualObjects([@"北京" mgl_stringByTransliteratingIntoScript:@"Arab"], @"بِِ̌ جِينگ"); + XCTAssertEqualObjects([@"北京" mgl_stringByTransliteratingIntoScript:@"Fake"], @"北京"); + + XCTAssertEqualObjects([@"Mосква" mgl_stringByTransliteratingIntoScript:@"Latn"], @"Moskva"); + XCTAssertEqualObjects([@"Mосква" mgl_stringByTransliteratingIntoScript:@"Hans"], @"Mосква"); + XCTAssertEqualObjects([@"Mосква" mgl_stringByTransliteratingIntoScript:@"Cyrl"], @"Москва"); + XCTAssertEqualObjects([@"Mосква" mgl_stringByTransliteratingIntoScript:@"Arab"], @"مُسكڤَ"); + XCTAssertEqualObjects([@"Mосква" mgl_stringByTransliteratingIntoScript:@"Fake"], @"Mосква"); + + XCTAssertEqualObjects([@"ロンドン" mgl_stringByTransliteratingIntoScript:@"Latn"], @"rondon"); + XCTAssertEqualObjects([@"ロンドン" mgl_stringByTransliteratingIntoScript:@"Hans"], @"ロンドン"); + XCTAssertEqualObjects([@"ロンドン" mgl_stringByTransliteratingIntoScript:@"Cyrl"], @"рондон"); + XCTAssertEqualObjects([@"ロンドン" mgl_stringByTransliteratingIntoScript:@"Arab"], @"رُندُن"); + XCTAssertEqualObjects([@"ロンドン" mgl_stringByTransliteratingIntoScript:@"Fake"], @"ロンドン"); } @end diff --git a/platform/darwin/test/MGLStyleLayerTests.h b/platform/darwin/test/MGLStyleLayerTests.h index 28c316c8ba..c7577819b8 100644 --- a/platform/darwin/test/MGLStyleLayerTests.h +++ b/platform/darwin/test/MGLStyleLayerTests.h @@ -14,7 +14,7 @@ @interface NSString (MGLStyleLayerTestAdditions) -@property (nonatomic, readonly, copy) NS_ARRAY_OF(NSString *) *lexicalClasses; +@property (nonatomic, readonly, copy) NSArray<NSString *> *lexicalClasses; @property (nonatomic, readonly, copy) NSString *lemma; @end diff --git a/platform/darwin/test/MGLStyleLayerTests.m b/platform/darwin/test/MGLStyleLayerTests.m index b51fa02af4..52b36dba00 100644 --- a/platform/darwin/test/MGLStyleLayerTests.m +++ b/platform/darwin/test/MGLStyleLayerTests.m @@ -33,7 +33,7 @@ } - (void)testPropertyName:(NSString *)name isBoolean:(BOOL)isBoolean { - NS_MUTABLE_ARRAY_OF(NSString *) *components = [name componentsSeparatedByString:@"-"].mutableCopy; + NSMutableArray<NSString *> *components = [name componentsSeparatedByString:@"-"].mutableCopy; if (isBoolean) { if ([components.firstObject isEqualToString:@"is"]) { [components removeObjectAtIndex:0]; @@ -67,7 +67,7 @@ @implementation NSString (MGLStyleLayerTestAdditions) -- (NS_ARRAY_OF(NSString *) *)lexicalClasses { +- (NSArray<NSString *> *)lexicalClasses { NSOrthography *orthography = [NSOrthography orthographyWithDominantScript:@"Latn" languageMap:@{@"Latn": @[@"en"]}]; NSLinguisticTaggerOptions options = (NSLinguisticTaggerOmitPunctuation diff --git a/platform/default/sqlite3.cpp b/platform/default/sqlite3.cpp index 8a567d602e..8f9c34191f 100644 --- a/platform/default/sqlite3.cpp +++ b/platform/default/sqlite3.cpp @@ -291,11 +291,12 @@ template <> void Query::bind(int offset, const char *value) { } // We currently cannot use sqlite3_bind_blob64 / sqlite3_bind_text64 because they -// was introduced in SQLite 3.8.7, and we need to support earlier versions: -// iOS 8.0: 3.7.13 -// iOS 8.2: 3.8.5 -// According to http://stackoverflow.com/questions/14288128/what-version-of-sqlite-does-ios-provide, -// the first iOS version with 3.8.7+ was 9.0, with 3.8.8. +// were introduced in SQLite 3.8.7, and we need to support earlier versions: +// Android 11: 3.7 +// Android 21: 3.8 +// Android 24: 3.9 +// Per https://developer.android.com/reference/android/database/sqlite/package-summary. +// The first iOS version with 3.8.7+ was 9.0, with 3.8.8. void Query::bind(int offset, const char * value, std::size_t length, bool retain) { assert(stmt.impl); diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 1775d628f6..5c3686d7a8 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -4,6 +4,10 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT ## master +### Packaging + +* The minimum deployment target for this SDK is now iOS 9.0. ([#11776](https://github.com/mapbox/mapbox-gl-native/pull/11776)) + ### Style layers * Deprecated `+[NSExpression featurePropertiesVariableExpression]` use `+[NSExpression featureAttributesVariableExpression]` instead. ([#11748](https://github.com/mapbox/mapbox-gl-native/pull/11748)) diff --git a/platform/ios/DEVELOPING.md b/platform/ios/DEVELOPING.md index 7a97074d38..b407e78e4b 100644 --- a/platform/ios/DEVELOPING.md +++ b/platform/ios/DEVELOPING.md @@ -4,7 +4,7 @@ This document explains how to build the Mapbox Maps SDK for iOS from source. It ## Requirements -The Mapbox Maps SDK for iOS and iosapp demo application require iOS 8.0 or above. _Note: Support for iOS 8 will be removed in a future release and the minimum iOS deployment version will increase to iOS 9.0._ +The Mapbox Maps SDK for iOS and iosapp demo application require iOS 9.0 or above. The Mapbox Maps SDK for iOS requires Xcode 9.1 or above to compile from source. diff --git a/platform/ios/INSTALL.md b/platform/ios/INSTALL.md index 01f4621b1e..f253d3019d 100644 --- a/platform/ios/INSTALL.md +++ b/platform/ios/INSTALL.md @@ -4,13 +4,12 @@ This document explains how to build a development version of Mapbox Maps SDK for ### Requirements -The Mapbox Maps SDK for iOS is intended to run on iOS 8.0 and above on the following devices: +The Mapbox Maps SDK for iOS is intended to run on iOS 9.0 and above on the following devices: * iPhone 4s and above (5, 5c, 5s, 6, 6 Plus, 7, 7 Plus, 8, 8 Plus, X) * iPad 2 and above (3, 4, Mini, Air, Mini 2, Air 2, Pro) * iPod touch 5th generation and above -_Note: Support for iOS 8 will be removed in a future release and the minimum iOS deployment version will increase to iOS 9.0._ Note that 32-bit simulators (such as the iPhone 5 or iPad 2) are not supported. diff --git a/platform/ios/Mapbox-iOS-SDK-nightly-dynamic.podspec b/platform/ios/Mapbox-iOS-SDK-nightly-dynamic.podspec index 7ea1b993ef..e07178311b 100644 --- a/platform/ios/Mapbox-iOS-SDK-nightly-dynamic.podspec +++ b/platform/ios/Mapbox-iOS-SDK-nightly-dynamic.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |m| } m.platform = :ios - m.ios.deployment_target = '8.0' + m.ios.deployment_target = '9.0' m.requires_arc = true diff --git a/platform/ios/Mapbox-iOS-SDK-static-part.podspec b/platform/ios/Mapbox-iOS-SDK-static-part.podspec index b2a114f9d2..bd98bb7272 100644 --- a/platform/ios/Mapbox-iOS-SDK-static-part.podspec +++ b/platform/ios/Mapbox-iOS-SDK-static-part.podspec @@ -1,4 +1,4 @@ - m.ios.deployment_target = '8.0' + m.ios.deployment_target = '9.0' m.requires_arc = true diff --git a/platform/ios/Mapbox-iOS-SDK-symbols.podspec b/platform/ios/Mapbox-iOS-SDK-symbols.podspec index 47a021598f..fbf65f0b24 100644 --- a/platform/ios/Mapbox-iOS-SDK-symbols.podspec +++ b/platform/ios/Mapbox-iOS-SDK-symbols.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |m| } m.platform = :ios - m.ios.deployment_target = '8.0' + m.ios.deployment_target = '9.0' m.requires_arc = true diff --git a/platform/ios/Mapbox-iOS-SDK.podspec b/platform/ios/Mapbox-iOS-SDK.podspec index 73412890c8..5a8e913dd9 100644 --- a/platform/ios/Mapbox-iOS-SDK.podspec +++ b/platform/ios/Mapbox-iOS-SDK.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |m| } m.platform = :ios - m.ios.deployment_target = '8.0' + m.ios.deployment_target = '9.0' m.requires_arc = true diff --git a/platform/ios/app/MBXOfflinePacksTableViewController.m b/platform/ios/app/MBXOfflinePacksTableViewController.m index 26a15a0b95..959ae57548 100644 --- a/platform/ios/app/MBXOfflinePacksTableViewController.m +++ b/platform/ios/app/MBXOfflinePacksTableViewController.m @@ -45,7 +45,7 @@ static NSString * const MBXOfflinePacksTableViewActiveCellReuseIdentifier = @"Ac [[NSNotificationCenter defaultCenter] removeObserver:self]; } -- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NS_DICTIONARY_OF(NSString *, id) *)change context:(void *)context { +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *, id> *)change context:(void *)context { if ([keyPath isEqualToString:@"packs"]) { NSKeyValueChange changeKind = [change[NSKeyValueChangeKindKey] unsignedIntegerValue]; NSIndexSet *indices = change[NSKeyValueChangeIndexesKey]; @@ -119,9 +119,7 @@ static NSString * const MBXOfflinePacksTableViewActiveCellReuseIdentifier = @"Ac }]; }]; [alertController addAction:downloadAction]; - if ([alertController respondsToSelector:@selector(setPreferredAction:)]) { - alertController.preferredAction = downloadAction; - } + alertController.preferredAction = downloadAction; [self presentViewController:alertController animated:YES completion:nil]; } diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index 391af5ea05..80163c7d40 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -175,9 +175,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { self.debugLoggingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:@"MGLMapboxMetricsDebugLoggingEnabled"]; self.mapView.showsScale = YES; self.mapView.showsUserHeadingIndicator = YES; - if ([UIFont respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) { - self.hudLabel.titleLabel.font = [UIFont monospacedDigitSystemFontOfSize:10 weight:UIFontWeightRegular]; - } + self.hudLabel.titleLabel.font = [UIFont monospacedDigitSystemFontOfSize:10 weight:UIFontWeightRegular]; if ([MGLAccountManager accessToken].length) { @@ -207,11 +205,8 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { [self.mapView reloadStyle:self]; }]; [alertController addAction:OKAction]; + alertController.preferredAction = OKAction; - if ([alertController respondsToSelector:@selector(setPreferredAction:)]) - { - alertController.preferredAction = OKAction; - } [self presentViewController:alertController animated:YES completion:nil]; } } @@ -1532,7 +1527,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { [self continueWorldTourWithRemainingAnnotations:annotations]; } -- (void)continueWorldTourWithRemainingAnnotations:(NS_MUTABLE_ARRAY_OF(MGLPointAnnotation *) *)annotations +- (void)continueWorldTourWithRemainingAnnotations:(NSMutableArray<MGLPointAnnotation *> *)annotations { MGLPointAnnotation *nextAnnotation = annotations.firstObject; if (!nextAnnotation || !_isTouringWorld) diff --git a/platform/ios/benchmark/MBXBenchViewController.mm b/platform/ios/benchmark/MBXBenchViewController.mm index d4629e2521..84c2790d50 100644 --- a/platform/ios/benchmark/MBXBenchViewController.mm +++ b/platform/ios/benchmark/MBXBenchViewController.mm @@ -76,10 +76,8 @@ [self startBenchmarkIteration]; }]; [alertController addAction:OKAction]; + alertController.preferredAction = OKAction; - if ([alertController respondsToSelector:@selector(setPreferredAction:)]) { - alertController.preferredAction = OKAction; - } [self presentViewController:alertController animated:YES completion:nil]; } } diff --git a/platform/ios/docs/doc-README.md b/platform/ios/docs/doc-README.md index 7cd0376d07..3a95aa96de 100644 --- a/platform/ios/docs/doc-README.md +++ b/platform/ios/docs/doc-README.md @@ -1,6 +1,6 @@ # [Mapbox Maps SDK for iOS](https://www.mapbox.com/ios-sdk/) -The Mapbox Maps SDK for iOS is an open-source framework for embedding interactive map views with scalable, customizable vector maps into Cocoa Touch applications on iOS 8.0 and above using Objective-C, Swift, or Interface Builder. It takes stylesheets that conform to the [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/), applies them to vector tiles that conform to the [Mapbox Vector Tile Specification](https://www.mapbox.com/developers/vector-tiles/), and renders them using OpenGL. +The Mapbox Maps SDK for iOS is an open-source framework for embedding interactive map views with scalable, customizable vector maps into Cocoa Touch applications on iOS 9.0 and above using Objective-C, Swift, or Interface Builder. It takes stylesheets that conform to the [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/), applies them to vector tiles that conform to the [Mapbox Vector Tile Specification](https://www.mapbox.com/developers/vector-tiles/), and renders them using OpenGL. ![Mapbox Maps SDK for iOS screenshots](img/screenshot.png) diff --git a/platform/ios/docs/pod-README.md b/platform/ios/docs/pod-README.md index f94073bd9f..8a3080055d 100644 --- a/platform/ios/docs/pod-README.md +++ b/platform/ios/docs/pod-README.md @@ -1,6 +1,6 @@ # [Mapbox Maps SDK for iOS](https://www.mapbox.com/ios-sdk/) -The Mapbox Maps SDK for iOS is an open-source framework for embedding interactive map views with scalable, customizable vector maps into Cocoa Touch applications on iOS 8.0 and above using Objective-C, Swift, or Interface Builder. It takes stylesheets that conform to the [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/), applies them to vector tiles that conform to the [Mapbox Vector Tile Specification](https://www.mapbox.com/developers/vector-tiles/), and renders them using OpenGL. +The Mapbox Maps SDK for iOS is an open-source framework for embedding interactive map views with scalable, customizable vector maps into Cocoa Touch applications on iOS 9.0 and above using Objective-C, Swift, or Interface Builder. It takes stylesheets that conform to the [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/), applies them to vector tiles that conform to the [Mapbox Vector Tile Specification](https://www.mapbox.com/developers/vector-tiles/), and renders them using OpenGL. For more information, check out the [Mapbox Maps SDK for iOS homepage](https://www.mapbox.com/ios-sdk/) and the [full changelog](https://github.com/mapbox/mapbox-gl-native/blob/master/platform/ios/CHANGELOG.md) online. @@ -10,7 +10,7 @@ For more information, check out the [Mapbox Maps SDK for iOS homepage](https://w The Mapbox Maps SDK for iOS may be installed as either a dynamic framework or a static framework. (To reduce the download size, the static framework is omitted from some distributions; you may need to download the full package from the [release page](https://github.com/mapbox/mapbox-gl-native/releases/).) -Integrating the Mapbox Maps SDK for iOS requires Xcode 8.0 or higher. To use this SDK with Xcode 7.3.1, download and use a symbols build from the [releases](https://github.com/mapbox/mapbox-gl-native/releases) page. +Integrating the Mapbox Maps SDK for iOS requires Xcode 8.0 or higher. {{DYNAMIC}} diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index a9413accf2..cb5a5587a2 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -3371,7 +3371,6 @@ CODE_SIGN_STYLE = Automatic; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "Integration Tests/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 11.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.mapbox.integration-tests"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -3397,7 +3396,6 @@ CODE_SIGN_STYLE = Automatic; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "Integration Tests/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 11.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.mapbox.integration-tests"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -3423,7 +3421,6 @@ CODE_SIGN_STYLE = Automatic; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "Integration Test Harness/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 11.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.mapbox.Integration-Test-Harness"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -3448,7 +3445,6 @@ CODE_SIGN_STYLE = Automatic; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "Integration Test Harness/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 11.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.mapbox.Integration-Test-Harness"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -3506,7 +3502,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -3559,7 +3555,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; @@ -3575,7 +3571,6 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "$(SRCROOT)/app/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxGL; PRODUCT_NAME = "Mapbox GL"; @@ -3589,7 +3584,6 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "$(SRCROOT)/app/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxGL; PRODUCT_NAME = "Mapbox GL"; @@ -3624,7 +3618,6 @@ CLANG_ENABLE_MODULES = YES; HEADER_SEARCH_PATHS = "$(mbgl_core_INCLUDE_DIRECTORIES)"; INFOPLIST_FILE = test/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; OTHER_CFLAGS = "-fvisibility=hidden"; OTHER_CPLUSPLUSFLAGS = ( @@ -3649,7 +3642,6 @@ CLANG_ENABLE_MODULES = YES; HEADER_SEARCH_PATHS = "$(mbgl_core_INCLUDE_DIRECTORIES)"; INFOPLIST_FILE = test/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; OTHER_CFLAGS = "-fvisibility=hidden"; OTHER_CPLUSPLUSFLAGS = ( @@ -3684,7 +3676,6 @@ ); INFOPLIST_FILE = framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; OTHER_CFLAGS = "-fvisibility=hidden"; OTHER_CPLUSPLUSFLAGS = ( @@ -3727,7 +3718,6 @@ ); INFOPLIST_FILE = framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; OTHER_CFLAGS = "-fvisibility=hidden"; OTHER_CPLUSPLUSFLAGS = ( @@ -3841,7 +3831,6 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = "$(SRCROOT)/benchmark/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.bench; PRODUCT_NAME = "Bench GL"; @@ -3853,7 +3842,6 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = "$(SRCROOT)/benchmark/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.bench; PRODUCT_NAME = "Bench GL"; diff --git a/platform/ios/src/MGLAnnotationContainerView.h b/platform/ios/src/MGLAnnotationContainerView.h index 90d2964831..ccec3052a6 100644 --- a/platform/ios/src/MGLAnnotationContainerView.h +++ b/platform/ios/src/MGLAnnotationContainerView.h @@ -10,7 +10,7 @@ NS_ASSUME_NONNULL_BEGIN + (instancetype)annotationContainerViewWithAnnotationContainerView:(MGLAnnotationContainerView *)annotationContainerView; -- (void)addSubviews:(NS_ARRAY_OF(MGLAnnotationView *) *)subviews; +- (void)addSubviews:(NSArray<MGLAnnotationView *> *)subviews; @end diff --git a/platform/ios/src/MGLAnnotationContainerView.m b/platform/ios/src/MGLAnnotationContainerView.m index 9a823c839c..6c82a1836d 100644 --- a/platform/ios/src/MGLAnnotationContainerView.m +++ b/platform/ios/src/MGLAnnotationContainerView.m @@ -3,7 +3,7 @@ @interface MGLAnnotationContainerView () -@property (nonatomic) NS_MUTABLE_ARRAY_OF(MGLAnnotationView *) *annotationViews; +@property (nonatomic) NSMutableArray<MGLAnnotationView *> *annotationViews; @end @@ -26,7 +26,7 @@ return newAnnotationContainerView; } -- (void)addSubviews:(NS_ARRAY_OF(MGLAnnotationView *) *)subviews +- (void)addSubviews:(NSArray<MGLAnnotationView *> *)subviews { for (MGLAnnotationView *view in subviews) { diff --git a/platform/ios/src/MGLAnnotationContainerView_Private.h b/platform/ios/src/MGLAnnotationContainerView_Private.h index 007b03550b..9dce54842d 100644 --- a/platform/ios/src/MGLAnnotationContainerView_Private.h +++ b/platform/ios/src/MGLAnnotationContainerView_Private.h @@ -7,7 +7,7 @@ NS_ASSUME_NONNULL_BEGIN @interface MGLAnnotationContainerView (Private) -@property (nonatomic) NS_MUTABLE_ARRAY_OF(MGLAnnotationView *) *annotationViews; +@property (nonatomic) NSMutableArray<MGLAnnotationView *> *annotationViews; @end diff --git a/platform/ios/src/MGLMapAccessibilityElement.mm b/platform/ios/src/MGLMapAccessibilityElement.mm index 8bce38a145..c1cc5304d7 100644 --- a/platform/ios/src/MGLMapAccessibilityElement.mm +++ b/platform/ios/src/MGLMapAccessibilityElement.mm @@ -56,10 +56,8 @@ // may be in the local language, which may be written in another script. // Attempt to transform to the script of the preferred language, keeping // the original string if no transform exists or if transformation fails. - if (@available(iOS 9.0, *)) { - NSString *dominantScript = [NSOrthography mgl_dominantScriptForMapboxStreetsLanguage:languageCode]; - name = [name mgl_stringByTransliteratingIntoScript:dominantScript]; - } + NSString *dominantScript = [NSOrthography mgl_dominantScriptForMapboxStreetsLanguage:languageCode]; + name = [name mgl_stringByTransliteratingIntoScript:dominantScript]; self.accessibilityLabel = name; } diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h index 765f0f932b..bde8e6a71d 100644 --- a/platform/ios/src/MGLMapView.h +++ b/platform/ios/src/MGLMapView.h @@ -189,7 +189,7 @@ MGL_EXPORT IB_DESIGNABLE */ @property (nonatomic, readonly, nullable) MGLStyle *style; -@property (nonatomic, readonly) NS_ARRAY_OF(NSURL *) *bundledStyleURLs __attribute__((unavailable("Call the relevant class method of MGLStyle for the URL of a particular default style."))); +@property (nonatomic, readonly) NSArray<NSURL *> *bundledStyleURLs __attribute__((unavailable("Call the relevant class method of MGLStyle for the URL of a particular default style."))); /** URL of the style currently displayed in the receiver. @@ -286,7 +286,7 @@ MGL_EXPORT IB_DESIGNABLE */ - (IBAction)showAttribution:(id)sender; -@property (nonatomic) NS_ARRAY_OF(NSString *) *styleClasses __attribute__((unavailable("Support for style classes has been removed."))); +@property (nonatomic) NSArray<NSString *> *styleClasses __attribute__((unavailable("Support for style classes has been removed."))); - (BOOL)hasStyleClass:(NSString *)styleClass __attribute__((unavailable("Support for style classes has been removed."))); @@ -773,7 +773,7 @@ MGL_EXPORT IB_DESIGNABLE @param animated `YES` if you want the map region change to be animated, or `NO` if you want the map to display the new region immediately without animations. */ -- (void)showAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations animated:(BOOL)animated; +- (void)showAnnotations:(NSArray<id <MGLAnnotation>> *)annotations animated:(BOOL)animated; /** Sets the visible region so that the map displays the specified annotations with @@ -788,7 +788,7 @@ MGL_EXPORT IB_DESIGNABLE @param animated `YES` if you want the map region change to be animated, or `NO` if you want the map to display the new region immediately without animations. */ -- (void)showAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated; +- (void)showAnnotations:(NSArray<id <MGLAnnotation>> *)annotations edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated; /** A camera representing the current viewpoint of the map. @@ -1076,7 +1076,7 @@ MGL_EXPORT IB_DESIGNABLE annotations are associated with the map view, the value of this property is `nil`. */ -@property (nonatomic, readonly, nullable) NS_ARRAY_OF(id <MGLAnnotation>) *annotations; +@property (nonatomic, readonly, nullable) NSArray<id <MGLAnnotation>> *annotations; /** Adds an annotation to the map view. @@ -1104,7 +1104,7 @@ MGL_EXPORT IB_DESIGNABLE must conform to the `MGLAnnotation` protocol. The map view retains each individual annotation object. */ -- (void)addAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations; +- (void)addAnnotations:(NSArray<id <MGLAnnotation>> *)annotations; /** Removes an annotation from the map view, deselecting it if it is selected. @@ -1129,7 +1129,7 @@ MGL_EXPORT IB_DESIGNABLE @param annotations The array of annotation objects to remove. Objects in the array must conform to the `MGLAnnotation` protocol. */ -- (void)removeAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations; +- (void)removeAnnotations:(NSArray<id <MGLAnnotation>> *)annotations; /** Returns an `MGLAnnotationView` if the given annotation is currently associated @@ -1180,7 +1180,7 @@ MGL_EXPORT IB_DESIGNABLE annotations are associated with the map view or if no annotations associated with the map view are currently visible, the value of this property is `nil`. */ -@property (nonatomic, readonly, nullable) NS_ARRAY_OF(id <MGLAnnotation>) *visibleAnnotations; +@property (nonatomic, readonly, nullable) NSArray<id <MGLAnnotation>> *visibleAnnotations; /** Returns the list of annotations associated with the receiver that intersect with @@ -1191,7 +1191,7 @@ MGL_EXPORT IB_DESIGNABLE no annotations associated with the map view are currently visible in the rectangle. */ -- (nullable NS_ARRAY_OF(id <MGLAnnotation>) *)visibleAnnotationsInRect:(CGRect)rect; +- (nullable NSArray<id <MGLAnnotation>> *)visibleAnnotationsInRect:(CGRect)rect; #pragma mark Managing Annotation Selections @@ -1208,7 +1208,7 @@ MGL_EXPORT IB_DESIGNABLE @note In versions prior to `4.0.0` if the annotation was offscreen it was not selected. */ -@property (nonatomic, copy) NS_ARRAY_OF(id <MGLAnnotation>) *selectedAnnotations; +@property (nonatomic, copy) NSArray<id <MGLAnnotation>> *selectedAnnotations; /** Selects an annotation and displays its callout view. @@ -1246,7 +1246,7 @@ MGL_EXPORT IB_DESIGNABLE overlays are associated with the map view, the value of this property is empty array. */ -@property (nonatomic, readonly, nonnull) NS_ARRAY_OF(id <MGLOverlay>) *overlays; +@property (nonatomic, readonly, nonnull) NSArray<id <MGLOverlay>> *overlays; /** Adds a single overlay object to the map. @@ -1265,7 +1265,7 @@ MGL_EXPORT IB_DESIGNABLE @param overlays An array of objects, each of which must conform to the `MGLOverlay` protocol. */ -- (void)addOverlays:(NS_ARRAY_OF(id <MGLOverlay>) *)overlays; +- (void)addOverlays:(NSArray<id <MGLOverlay>> *)overlays; /** Removes a single overlay object from the map. @@ -1285,7 +1285,7 @@ MGL_EXPORT IB_DESIGNABLE @param overlays An array of objects, each of which conforms to the `MGLOverlay` protocol. */ -- (void)removeOverlays:(NS_ARRAY_OF(id <MGLOverlay>) *)overlays; +- (void)removeOverlays:(NSArray<id <MGLOverlay>> *)overlays; #pragma mark Accessing the Underlying Map Data @@ -1301,7 +1301,7 @@ MGL_EXPORT IB_DESIGNABLE @return An array of objects conforming to the `MGLFeature` protocol that represent features in the sources used by the current style. */ -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesAtPoint:(CGPoint)point NS_SWIFT_NAME(visibleFeatures(at:)); +- (NSArray<id <MGLFeature>> *)visibleFeaturesAtPoint:(CGPoint)point NS_SWIFT_NAME(visibleFeatures(at:)); /** Returns an array of rendered map features that intersect with a given point, @@ -1320,7 +1320,7 @@ MGL_EXPORT IB_DESIGNABLE @return An array of objects conforming to the `MGLFeature` protocol that represent features in the sources used by the current style. */ -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesAtPoint:(CGPoint)point inStyleLayersWithIdentifiers:(nullable NS_SET_OF(NSString *) *)styleLayerIdentifiers NS_SWIFT_NAME(visibleFeatures(at:styleLayerIdentifiers:)); +- (NSArray<id <MGLFeature>> *)visibleFeaturesAtPoint:(CGPoint)point inStyleLayersWithIdentifiers:(nullable NSSet<NSString *> *)styleLayerIdentifiers NS_SWIFT_NAME(visibleFeatures(at:styleLayerIdentifiers:)); /** Returns an array of rendered map features that intersect with a given point, @@ -1387,7 +1387,7 @@ MGL_EXPORT IB_DESIGNABLE @return An array of objects conforming to the `MGLFeature` protocol that represent features in the sources used by the current style. */ -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesAtPoint:(CGPoint)point inStyleLayersWithIdentifiers:(nullable NS_SET_OF(NSString *) *)styleLayerIdentifiers predicate:(nullable NSPredicate *)predicate NS_SWIFT_NAME(visibleFeatures(at:styleLayerIdentifiers:predicate:)); +- (NSArray<id <MGLFeature>> *)visibleFeaturesAtPoint:(CGPoint)point inStyleLayersWithIdentifiers:(nullable NSSet<NSString *> *)styleLayerIdentifiers predicate:(nullable NSPredicate *)predicate NS_SWIFT_NAME(visibleFeatures(at:styleLayerIdentifiers:predicate:)); /** Returns an array of rendered map features that intersect with the given @@ -1402,7 +1402,7 @@ MGL_EXPORT IB_DESIGNABLE @return An array of objects conforming to the `MGLFeature` protocol that represent features in the sources used by the current style. */ -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesInRect:(CGRect)rect NS_SWIFT_NAME(visibleFeatures(in:)); +- (NSArray<id <MGLFeature>> *)visibleFeaturesInRect:(CGRect)rect NS_SWIFT_NAME(visibleFeatures(in:)); /** Returns an array of rendered map features that intersect with the given @@ -1421,7 +1421,7 @@ MGL_EXPORT IB_DESIGNABLE @return An array of objects conforming to the `MGLFeature` protocol that represent features in the sources used by the current style. */ -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesInRect:(CGRect)rect inStyleLayersWithIdentifiers:(nullable NS_SET_OF(NSString *) *)styleLayerIdentifiers NS_SWIFT_NAME(visibleFeatures(in:styleLayerIdentifiers:)); +- (NSArray<id <MGLFeature>> *)visibleFeaturesInRect:(CGRect)rect inStyleLayersWithIdentifiers:(nullable NSSet<NSString *> *)styleLayerIdentifiers NS_SWIFT_NAME(visibleFeatures(in:styleLayerIdentifiers:)); /** Returns an array of rendered map features that intersect with the given @@ -1493,7 +1493,7 @@ MGL_EXPORT IB_DESIGNABLE @return An array of objects conforming to the `MGLFeature` protocol that represent features in the sources used by the current style. */ -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesInRect:(CGRect)rect inStyleLayersWithIdentifiers:(nullable NS_SET_OF(NSString *) *)styleLayerIdentifiers predicate:(nullable NSPredicate *)predicate NS_SWIFT_NAME(visibleFeatures(in:styleLayerIdentifiers:predicate:)); +- (NSArray<id <MGLFeature>> *)visibleFeaturesInRect:(CGRect)rect inStyleLayersWithIdentifiers:(nullable NSSet<NSString *> *)styleLayerIdentifiers predicate:(nullable NSPredicate *)predicate NS_SWIFT_NAME(visibleFeatures(in:styleLayerIdentifiers:predicate:)); #pragma mark Debugging the Map diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index b7d0974872..978547b9c6 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -194,14 +194,14 @@ public: @property (nonatomic) GLKView *glView; @property (nonatomic) UIImageView *glSnapshotView; -@property (nonatomic) NS_MUTABLE_ARRAY_OF(NSLayoutConstraint *) *scaleBarConstraints; +@property (nonatomic) NSMutableArray<NSLayoutConstraint *> *scaleBarConstraints; @property (nonatomic, readwrite) MGLScaleBar *scaleBar; @property (nonatomic, readwrite) UIImageView *compassView; -@property (nonatomic) NS_MUTABLE_ARRAY_OF(NSLayoutConstraint *) *compassViewConstraints; +@property (nonatomic) NSMutableArray<NSLayoutConstraint *> *compassViewConstraints; @property (nonatomic, readwrite) UIImageView *logoView; -@property (nonatomic) NS_MUTABLE_ARRAY_OF(NSLayoutConstraint *) *logoViewConstraints; +@property (nonatomic) NSMutableArray<NSLayoutConstraint *> *logoViewConstraints; @property (nonatomic, readwrite) UIButton *attributionButton; -@property (nonatomic) NS_MUTABLE_ARRAY_OF(NSLayoutConstraint *) *attributionButtonConstraints; +@property (nonatomic) NSMutableArray<NSLayoutConstraint *> *attributionButtonConstraints; @property (nonatomic, readwrite) MGLStyle *style; @@ -217,7 +217,7 @@ public: @property (nonatomic) MGLCameraChangeReason cameraChangeReasonBitmask; /// Mapping from reusable identifiers to annotation images. -@property (nonatomic) NS_MUTABLE_DICTIONARY_OF(NSString *, MGLAnnotationImage *) *annotationImagesByIdentifier; +@property (nonatomic) NSMutableDictionary<NSString *, MGLAnnotationImage *> *annotationImagesByIdentifier; /// Currently shown popover representing the selected annotation. @property (nonatomic) UIView<MGLCalloutView> *calloutViewForSelectedAnnotation; @@ -235,7 +235,7 @@ public: @property (nonatomic) MGLMapViewProxyAccessibilityElement *mapViewProxyAccessibilityElement; @property (nonatomic) MGLAnnotationContainerView *annotationContainerView; @property (nonatomic) MGLUserLocation *userLocation; -@property (nonatomic) NS_MUTABLE_DICTIONARY_OF(NSString *, NS_MUTABLE_ARRAY_OF(MGLAnnotationView *) *) *annotationViewReuseQueueByIdentifier; +@property (nonatomic) NSMutableDictionary<NSString *, NSMutableArray<MGLAnnotationView *> *> *annotationViewReuseQueueByIdentifier; @end @@ -287,9 +287,9 @@ public: BOOL _delegateHasLineWidthsForShapeAnnotations; MGLCompassDirectionFormatter *_accessibilityCompassFormatter; - NS_ARRAY_OF(id <MGLFeature>) *_visiblePlaceFeatures; - NS_ARRAY_OF(id <MGLFeature>) *_visibleRoadFeatures; - NS_MUTABLE_SET_OF(MGLFeatureAccessibilityElement *) *_featureAccessibilityElements; + NSArray<id <MGLFeature>> *_visiblePlaceFeatures; + NSArray<id <MGLFeature>> *_visibleRoadFeatures; + NSMutableSet<MGLFeatureAccessibilityElement *> *_featureAccessibilityElements; BOOL _accessibilityValueAnnouncementIsPending; MGLReachability *_reachability; @@ -335,12 +335,12 @@ public: } } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingStyle ++ (NSSet<NSString *> *)keyPathsForValuesAffectingStyle { return [NSSet setWithObject:@"styleURL"]; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingStyleURL ++ (NSSet<NSString *> *)keyPathsForValuesAffectingStyleURL { return [NSSet setWithObjects:@"styleURL__", nil]; } @@ -624,18 +624,8 @@ public: UIGraphicsBeginImageContextWithOptions(scaleImage.size, NO, [UIScreen mainScreen].scale); [scaleImage drawInRect:{ CGPointZero, scaleImage.size }]; - CGFloat northSize = 11; - UIFont *northFont; - if ([UIFont respondsToSelector:@selector(systemFontOfSize:weight:)]) - { - northFont = [UIFont systemFontOfSize:northSize weight:UIFontWeightUltraLight]; - } - else - { - northFont = [UIFont systemFontOfSize:northSize]; - } NSAttributedString *north = [[NSAttributedString alloc] initWithString:NSLocalizedStringWithDefaultValue(@"COMPASS_NORTH", nil, nil, @"N", @"Compass abbreviation for north") attributes:@{ - NSFontAttributeName: northFont, + NSFontAttributeName: [UIFont systemFontOfSize:11 weight:UIFontWeightUltraLight], NSForegroundColorAttributeName: [UIColor whiteColor], }]; CGRect stringRect = CGRectMake((scaleImage.size.width - north.size.width) / 2, @@ -1273,7 +1263,7 @@ public: } } -- (void)touchesBegan:(__unused NS_SET_OF(UITouch *) *)touches withEvent:(__unused UIEvent *)event +- (void)touchesBegan:(__unused NSSet<UITouch *> *)touches withEvent:(__unused UIEvent *)event { _changeDelimiterSuppressionDepth = 0; _mbglMap->setGestureInProgress(false); @@ -2238,22 +2228,22 @@ public: } } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingZoomEnabled ++ (NSSet<NSString *> *)keyPathsForValuesAffectingZoomEnabled { return [NSSet setWithObject:@"allowsZooming"]; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingScrollEnabled ++ (NSSet<NSString *> *)keyPathsForValuesAffectingScrollEnabled { return [NSSet setWithObject:@"allowsScrolling"]; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingRotateEnabled ++ (NSSet<NSString *> *)keyPathsForValuesAffectingRotateEnabled { return [NSSet setWithObject:@"allowsRotating"]; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingPitchEnabled ++ (NSSet<NSString *> *)keyPathsForValuesAffectingPitchEnabled { return [NSSet setWithObject:@"allowsTilting"]; } @@ -2419,7 +2409,7 @@ public: return value; } -- (NS_ARRAY_OF(id <MGLFeature>) *)visiblePlaceFeatures +- (NSArray<id <MGLFeature>> *)visiblePlaceFeatures { if (!_visiblePlaceFeatures) { @@ -2429,7 +2419,7 @@ public: return _visiblePlaceFeatures; } -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleRoadFeatures +- (NSArray<id <MGLFeature>> *)visibleRoadFeatures { if (!_visibleRoadFeatures) { @@ -2907,7 +2897,7 @@ public: #pragma mark - Geography - -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingCenterCoordinate ++ (NSSet<NSString *> *)keyPathsForValuesAffectingCenterCoordinate { return [NSSet setWithObjects:@"latitude", @"longitude", @"camera", nil]; } @@ -2998,7 +2988,7 @@ public: _mbglMap->easeTo(cameraOptions, animationOptions); } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingZoomLevel ++ (NSSet<NSString *> *)keyPathsForValuesAffectingZoomLevel { return [NSSet setWithObject:@"camera"]; } @@ -3167,7 +3157,7 @@ public: [self didChangeValueForKey:@"visibleCoordinateBounds"]; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingDirection ++ (NSSet<NSString *> *)keyPathsForValuesAffectingDirection { return [NSSet setWithObject:@"camera"]; } @@ -3217,12 +3207,12 @@ public: [self setDirection:direction animated:NO]; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingPitch ++ (NSSet<NSString *> *)keyPathsForValuesAffectingPitch { return [NSSet setWithObject:@"camera"]; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingCamera ++ (NSSet<NSString *> *)keyPathsForValuesAffectingCamera { return [NSSet setWithObjects:@"longitude", @"latitude", @"centerCoordinate", @"zoomLevel", @"direction", nil]; } @@ -3496,7 +3486,7 @@ public: #pragma mark - Annotations - -- (nullable NS_ARRAY_OF(id <MGLAnnotation>) *)annotations +- (nullable NSArray<id <MGLAnnotation>> *)annotations { if (_annotationContextsByAnnotationTag.empty()) { @@ -3520,12 +3510,12 @@ public: return [NSArray arrayWithObjects:&annotations[0] count:annotations.size()]; } -- (nullable NS_ARRAY_OF(id <MGLAnnotation>) *)visibleAnnotations +- (nullable NSArray<id <MGLAnnotation>> *)visibleAnnotations { return [self visibleAnnotationsInRect:self.bounds]; } -- (nullable NS_ARRAY_OF(id <MGLAnnotation>) *)visibleAnnotationsInRect:(CGRect)rect +- (nullable NSArray<id <MGLAnnotation>> *)visibleAnnotationsInRect:(CGRect)rect { if (_annotationContextsByAnnotationTag.empty()) { @@ -3599,7 +3589,7 @@ public: [self addAnnotations:@[ annotation ]]; } -- (void)addAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations +- (void)addAnnotations:(NSArray<id <MGLAnnotation>> *)annotations { if ( ! annotations) return; [self willChangeValueForKey:@"annotations"]; @@ -3740,7 +3730,7 @@ public: UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil); } -- (void)updateAnnotationContainerViewWithAnnotationViews:(NS_ARRAY_OF(MGLAnnotationView *) *)annotationViews +- (void)updateAnnotationContainerViewWithAnnotationViews:(NSArray<MGLAnnotationView *> *)annotationViews { if (annotationViews.count == 0) return; @@ -3895,7 +3885,7 @@ public: [self removeAnnotations:@[ annotation ]]; } -- (void)removeAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations +- (void)removeAnnotations:(NSArray<id <MGLAnnotation>> *)annotations { if ( ! annotations) return; @@ -3956,11 +3946,11 @@ public: } } -- (nonnull NS_ARRAY_OF(id <MGLOverlay>) *)overlays +- (nonnull NSArray<id <MGLOverlay>> *)overlays { if (self.annotations == nil) { return @[]; } - NS_MUTABLE_ARRAY_OF(id <MGLOverlay>) *mutableOverlays = [NSMutableArray array]; + NSMutableArray<id <MGLOverlay>> *mutableOverlays = [NSMutableArray array]; [self.annotations enumerateObjectsUsingBlock:^(id<MGLAnnotation> _Nonnull annotation, NSUInteger idx, BOOL * _Nonnull stop) { if ([annotation conformsToProtocol:@protocol(MGLOverlay)]) @@ -3977,7 +3967,7 @@ public: [self addOverlays:@[ overlay ]]; } -- (void)addOverlays:(NS_ARRAY_OF(id <MGLOverlay>) *)overlays +- (void)addOverlays:(NSArray<id <MGLOverlay>> *)overlays { #if DEBUG for (id <MGLOverlay> overlay in overlays) @@ -3994,7 +3984,7 @@ public: [self removeOverlays:@[ overlay ]]; } -- (void)removeOverlays:(NS_ARRAY_OF(id <MGLOverlay>) *)overlays +- (void)removeOverlays:(NSArray<id <MGLOverlay>> *)overlays { #if DEBUG for (id <MGLOverlay> overlay in overlays) @@ -4226,13 +4216,13 @@ public: [self didChangeValueForKey:@"selectedAnnotations"]; } -- (NS_ARRAY_OF(id <MGLAnnotation>) *)selectedAnnotations +- (NSArray<id <MGLAnnotation>> *)selectedAnnotations { id <MGLAnnotation> selectedAnnotation = self.selectedAnnotation; return (selectedAnnotation ? @[ selectedAnnotation ] : @[]); } -- (void)setSelectedAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)selectedAnnotations +- (void)setSelectedAnnotations:(NSArray<id <MGLAnnotation>> *)selectedAnnotations { if ( ! selectedAnnotations.count) return; @@ -4578,7 +4568,7 @@ public: completion:NULL]; } -- (void)showAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations animated:(BOOL)animated +- (void)showAnnotations:(NSArray<id <MGLAnnotation>> *)annotations animated:(BOOL)animated { CGFloat maximumPadding = 100; CGFloat yPadding = (self.frame.size.height / 5 <= maximumPadding) ? (self.frame.size.height / 5) : maximumPadding; @@ -4589,7 +4579,7 @@ public: [self showAnnotations:annotations edgePadding:edgeInsets animated:animated]; } -- (void)showAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated +- (void)showAnnotations:(NSArray<id <MGLAnnotation>> *)annotations edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated { if ( ! annotations || ! annotations.count) return; @@ -4777,7 +4767,7 @@ public: } } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingUserLocation ++ (NSSet<NSString *> *)keyPathsForValuesAffectingUserLocation { return [NSSet setWithObject:@"userLocationAnnotationView"]; } @@ -5268,16 +5258,16 @@ public: #pragma mark Data -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesAtPoint:(CGPoint)point +- (NSArray<id <MGLFeature>> *)visibleFeaturesAtPoint:(CGPoint)point { return [self visibleFeaturesAtPoint:point inStyleLayersWithIdentifiers:nil]; } -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesAtPoint:(CGPoint)point inStyleLayersWithIdentifiers:(NS_SET_OF(NSString *) *)styleLayerIdentifiers { +- (NSArray<id <MGLFeature>> *)visibleFeaturesAtPoint:(CGPoint)point inStyleLayersWithIdentifiers:(NSSet<NSString *> *)styleLayerIdentifiers { return [self visibleFeaturesAtPoint:point inStyleLayersWithIdentifiers:styleLayerIdentifiers predicate:nil]; } -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesAtPoint:(CGPoint)point inStyleLayersWithIdentifiers:(NS_SET_OF(NSString *) *)styleLayerIdentifiers predicate:(NSPredicate *)predicate +- (NSArray<id <MGLFeature>> *)visibleFeaturesAtPoint:(CGPoint)point inStyleLayersWithIdentifiers:(NSSet<NSString *> *)styleLayerIdentifiers predicate:(NSPredicate *)predicate { mbgl::ScreenCoordinate screenCoordinate = { point.x, point.y }; @@ -5302,15 +5292,15 @@ public: return MGLFeaturesFromMBGLFeatures(features); } -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesInRect:(CGRect)rect { +- (NSArray<id <MGLFeature>> *)visibleFeaturesInRect:(CGRect)rect { return [self visibleFeaturesInRect:rect inStyleLayersWithIdentifiers:nil]; } -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesInRect:(CGRect)rect inStyleLayersWithIdentifiers:(NS_SET_OF(NSString *) *)styleLayerIdentifiers { +- (NSArray<id <MGLFeature>> *)visibleFeaturesInRect:(CGRect)rect inStyleLayersWithIdentifiers:(NSSet<NSString *> *)styleLayerIdentifiers { return [self visibleFeaturesInRect:rect inStyleLayersWithIdentifiers:styleLayerIdentifiers predicate:nil]; } -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesInRect:(CGRect)rect inStyleLayersWithIdentifiers:(NS_SET_OF(NSString *) *)styleLayerIdentifiers predicate:(NSPredicate *)predicate { +- (NSArray<id <MGLFeature>> *)visibleFeaturesInRect:(CGRect)rect inStyleLayersWithIdentifiers:(NSSet<NSString *> *)styleLayerIdentifiers predicate:(NSPredicate *)predicate { mbgl::ScreenBox screenBox = { { CGRectGetMinX(rect), CGRectGetMinY(rect) }, { CGRectGetMaxX(rect), CGRectGetMaxY(rect) }, @@ -6040,7 +6030,7 @@ public: views:views]]; } -- (NS_MUTABLE_ARRAY_OF(MGLAnnotationView *) *)annotationViewReuseQueueForIdentifier:(NSString *)identifier { +- (NSMutableArray<MGLAnnotationView *> *)annotationViewReuseQueueForIdentifier:(NSString *)identifier { if (!_annotationViewReuseQueueByIdentifier[identifier]) { _annotationViewReuseQueueByIdentifier[identifier] = [NSMutableArray array]; @@ -6197,7 +6187,7 @@ private: @implementation MGLMapView (IBAdditions) -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingStyleURL__ ++ (NSSet<NSString *> *)keyPathsForValuesAffectingStyleURL__ { return [NSSet setWithObject:@"styleURL"]; } @@ -6220,7 +6210,7 @@ private: self.styleURL = url; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingLatitude ++ (NSSet<NSString *> *)keyPathsForValuesAffectingLatitude { return [NSSet setWithObjects:@"centerCoordinate", @"camera", nil]; } @@ -6246,7 +6236,7 @@ private: } } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingLongitude ++ (NSSet<NSString *> *)keyPathsForValuesAffectingLongitude { return [NSSet setWithObjects:@"centerCoordinate", @"camera", nil]; } @@ -6272,7 +6262,7 @@ private: } } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingAllowsZooming ++ (NSSet<NSString *> *)keyPathsForValuesAffectingAllowsZooming { return [NSSet setWithObject:@"zoomEnabled"]; } @@ -6287,7 +6277,7 @@ private: self.zoomEnabled = allowsZooming; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingAllowsScrolling ++ (NSSet<NSString *> *)keyPathsForValuesAffectingAllowsScrolling { return [NSSet setWithObject:@"scrollEnabled"]; } @@ -6302,7 +6292,7 @@ private: self.scrollEnabled = allowsScrolling; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingAllowsRotating ++ (NSSet<NSString *> *)keyPathsForValuesAffectingAllowsRotating { return [NSSet setWithObject:@"rotateEnabled"]; } @@ -6317,7 +6307,7 @@ private: self.rotateEnabled = allowsRotating; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingAllowsTilting ++ (NSSet<NSString *> *)keyPathsForValuesAffectingAllowsTilting { return [NSSet setWithObject:@"pitchEnabled"]; } @@ -6332,7 +6322,7 @@ private: self.pitchEnabled = allowsTilting; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingShowsHeading ++ (NSSet<NSString *> *)keyPathsForValuesAffectingShowsHeading { return [NSSet setWithObject:@"showsUserHeadingIndicator"]; } diff --git a/platform/ios/src/MGLMapViewDelegate.h b/platform/ios/src/MGLMapViewDelegate.h index 0368d8413c..201e3db84b 100644 --- a/platform/ios/src/MGLMapViewDelegate.h +++ b/platform/ios/src/MGLMapViewDelegate.h @@ -428,7 +428,7 @@ NS_ASSUME_NONNULL_BEGIN @param annotationViews An array of `MGLAnnotationView` objects representing the views that were added. */ -- (void)mapView:(MGLMapView *)mapView didAddAnnotationViews:(NS_ARRAY_OF(MGLAnnotationView *) *)annotationViews; +- (void)mapView:(MGLMapView *)mapView didAddAnnotationViews:(NSArray<MGLAnnotationView *> *)annotationViews; #pragma mark Selecting Annotations diff --git a/platform/ios/src/MGLScaleBar.mm b/platform/ios/src/MGLScaleBar.mm index 139dffdfab..a2fc24c75c 100644 --- a/platform/ios/src/MGLScaleBar.mm +++ b/platform/ios/src/MGLScaleBar.mm @@ -178,12 +178,7 @@ static const CGFloat MGLFeetPerMeter = 3.28084; #pragma mark - Convenience methods - (BOOL)usesRightToLeftLayout { - // semanticContentAttribute is iOS 9+ - if ([self.superview respondsToSelector:@selector(semanticContentAttribute)]) { - return [UIView userInterfaceLayoutDirectionForSemanticContentAttribute:self.superview.semanticContentAttribute] == UIUserInterfaceLayoutDirectionRightToLeft; - } else { - return UIApplication.sharedApplication.userInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft; - } + return [UIView userInterfaceLayoutDirectionForSemanticContentAttribute:self.superview.semanticContentAttribute] == UIUserInterfaceLayoutDirectionRightToLeft; } - (BOOL)usesMetricSystem { diff --git a/platform/ios/src/MGLUserLocation.m b/platform/ios/src/MGLUserLocation.m index 074d138a72..245cbf4371 100644 --- a/platform/ios/src/MGLUserLocation.m +++ b/platform/ios/src/MGLUserLocation.m @@ -68,7 +68,7 @@ NS_ASSUME_NONNULL_END return ! [key isEqualToString:@"location"] && ! [key isEqualToString:@"heading"]; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingCoordinate ++ (NSSet<NSString *> *)keyPathsForValuesAffectingCoordinate { return [NSSet setWithObject:@"location"]; } diff --git a/platform/ios/test/MGLMapAccessibilityElementTests.m b/platform/ios/test/MGLMapAccessibilityElementTests.m index 89a595421e..916461e708 100644 --- a/platform/ios/test/MGLMapAccessibilityElementTests.m +++ b/platform/ios/test/MGLMapAccessibilityElementTests.m @@ -25,11 +25,7 @@ @"name_en": @"Цинциннати", }; element = [[MGLFeatureAccessibilityElement alloc] initWithAccessibilityContainer:self feature:feature]; - if (@available(iOS 9.0, *)) { - XCTAssertEqualObjects(element.accessibilityLabel, @"Cincinnati", @"Accessibility label should be romanized."); - } else { - XCTAssertEqualObjects(element.accessibilityLabel, @"Цинциннати", @"Accessibility label should not be romanized."); - } + XCTAssertEqualObjects(element.accessibilityLabel, @"Cincinnati", @"Accessibility label should be romanized."); } - (void)testPlaceFeatureValues { diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md index 498ed3c379..00d242211c 100644 --- a/platform/macos/CHANGELOG.md +++ b/platform/macos/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog for Mapbox Maps SDK for macOS +## master + +### Packaging + +* The minimum deployment target for this SDK is now macOS 10.11.0. ([#11776](https://github.com/mapbox/mapbox-gl-native/pull/11776)) + ## 0.7.1 ### Style layers diff --git a/platform/macos/Mapbox-macOS-SDK-symbols.podspec b/platform/macos/Mapbox-macOS-SDK-symbols.podspec index 597f97d03c..2df93c6f42 100644 --- a/platform/macos/Mapbox-macOS-SDK-symbols.podspec +++ b/platform/macos/Mapbox-macOS-SDK-symbols.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |m| } m.platform = :osx - m.osx.deployment_target = '10.10' + m.osx.deployment_target = '10.11' m.requires_arc = true diff --git a/platform/macos/Mapbox-macOS-SDK.podspec b/platform/macos/Mapbox-macOS-SDK.podspec index 734ab19390..14b7426097 100644 --- a/platform/macos/Mapbox-macOS-SDK.podspec +++ b/platform/macos/Mapbox-macOS-SDK.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |m| } m.platform = :osx - m.osx.deployment_target = '10.10' + m.osx.deployment_target = '10.11' m.requires_arc = true diff --git a/platform/macos/app/AppDelegate.m b/platform/macos/app/AppDelegate.m index 0d780424f9..f7b35d0c83 100644 --- a/platform/macos/app/AppDelegate.m +++ b/platform/macos/app/AppDelegate.m @@ -29,7 +29,7 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask"; } } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingCountOfResourcesCompleted { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingCountOfResourcesCompleted { return [NSSet setWithObjects:@"progress", nil]; } @@ -37,7 +37,7 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask"; return self.progress.countOfResourcesCompleted; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingCountOfResourcesExpected { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingCountOfResourcesExpected { return [NSSet setWithObjects:@"progress", nil]; } @@ -45,7 +45,7 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask"; return self.progress.countOfResourcesExpected; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingCountOfBytesCompleted { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingCountOfBytesCompleted { return [NSSet setWithObjects:@"progress", nil]; } @@ -53,7 +53,7 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask"; return self.progress.countOfBytesCompleted; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingCountOfTilesCompleted { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingCountOfTilesCompleted { return [NSSet setWithObjects:@"progress", nil]; } @@ -61,7 +61,7 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask"; return self.progress.countOfTilesCompleted; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingCountOfTileBytesCompleted { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingCountOfTileBytesCompleted { return [NSSet setWithObjects:@"progress", nil]; } @@ -157,11 +157,11 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask"; - (void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent { // mapboxgl://?center=29.95,-90.066667&zoom=14&bearing=45&pitch=30 NSURL *url = [NSURL URLWithString:[event paramDescriptorForKeyword:keyDirectObject].stringValue]; - NS_MUTABLE_DICTIONARY_OF(NSString *, NSString *) *params = [[NSMutableDictionary alloc] init]; + NSMutableDictionary<NSString *, NSString *> *params = [[NSMutableDictionary alloc] init]; for (NSString *param in [url.query componentsSeparatedByString:@"&"]) { NSArray *parts = [param componentsSeparatedByString:@"="]; if (parts.count >= 2) { - params[parts[0]] = [parts[1] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + params[parts[0]] = [parts[1] stringByRemovingPercentEncoding]; } } diff --git a/platform/macos/app/MGLStyle+MBXAdditions.h b/platform/macos/app/MGLStyle+MBXAdditions.h index dcaf42af28..29c2cda867 100644 --- a/platform/macos/app/MGLStyle+MBXAdditions.h +++ b/platform/macos/app/MGLStyle+MBXAdditions.h @@ -2,6 +2,6 @@ @interface MGLStyle (MBXAdditions) -@property (nonatomic, strong) NS_ARRAY_OF(__kindof MGLStyleLayer *) *reversedLayers; +@property (nonatomic, strong) NSArray<__kindof MGLStyleLayer *> *reversedLayers; @end diff --git a/platform/macos/app/MGLStyle+MBXAdditions.m b/platform/macos/app/MGLStyle+MBXAdditions.m index be571d8b30..a0773cc2c0 100644 --- a/platform/macos/app/MGLStyle+MBXAdditions.m +++ b/platform/macos/app/MGLStyle+MBXAdditions.m @@ -2,15 +2,15 @@ @implementation MGLStyle (MBXAdditions) -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingReversedLayers { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingReversedLayers { return [NSSet setWithObject:@"layers"]; } -- (NS_ARRAY_OF(__kindof MGLStyleLayer *) *)reversedLayers { +- (NSArray<__kindof MGLStyleLayer *> *)reversedLayers { return self.layers.reverseObjectEnumerator.allObjects; } -- (void)setReversedLayers:(NS_ARRAY_OF(__kindof MGLStyleLayer *) *)reversedLayers { +- (void)setReversedLayers:(NSArray<__kindof MGLStyleLayer *> *)reversedLayers { self.layers = reversedLayers.reverseObjectEnumerator.allObjects; } diff --git a/platform/macos/app/MapDocument.m b/platform/macos/app/MapDocument.m index 9b18dbd761..7be500ae6a 100644 --- a/platform/macos/app/MapDocument.m +++ b/platform/macos/app/MapDocument.m @@ -19,7 +19,7 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = { { .latitude = -13.15589555, .longitude = -74.2178961777998 }, }; -NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotation>) *shapes) { +NSArray<id <MGLAnnotation>> *MBXFlattenedShapes(NSArray<id <MGLAnnotation>> *shapes) { NSMutableArray *flattenedShapes = [NSMutableArray arrayWithCapacity:shapes.count]; for (id <MGLAnnotation> shape in shapes) { NSArray *subshapes; @@ -340,7 +340,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio } - (void)toggleStyleLayersAtArrangedObjectIndexes:(NSIndexSet *)indices { - NS_ARRAY_OF(MGLStyleLayer *) *layers = [self.mapView.style.reversedLayers objectsAtIndexes:indices]; + NSArray<MGLStyleLayer *> *layers = [self.mapView.style.reversedLayers objectsAtIndexes:indices]; BOOL isVisible = layers.firstObject.visible; [self.undoManager registerUndoWithTarget:self handler:^(MapDocument * _Nonnull target) { [target toggleStyleLayersAtArrangedObjectIndexes:indices]; @@ -376,7 +376,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio [self deleteStyleLayersAtArrangedObjectIndexes:indices]; } -- (void)insertStyleLayers:(NS_ARRAY_OF(MGLStyleLayer *) *)layers atArrangedObjectIndexes:(NSIndexSet *)indices { +- (void)insertStyleLayers:(NSArray<MGLStyleLayer *> *)layers atArrangedObjectIndexes:(NSIndexSet *)indices { [self.undoManager registerUndoWithTarget:self handler:^(id _Nonnull target) { [self deleteStyleLayersAtArrangedObjectIndexes:indices]; }]; @@ -396,7 +396,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio } - (void)deleteStyleLayersAtArrangedObjectIndexes:(NSIndexSet *)indices { - NS_ARRAY_OF(MGLStyleLayer *) *layers = [self.mapView.style.reversedLayers objectsAtIndexes:indices]; + NSArray<MGLStyleLayer *> *layers = [self.mapView.style.reversedLayers objectsAtIndexes:indices]; [self.undoManager registerUndoWithTarget:self handler:^(id _Nonnull target) { [self insertStyleLayers:layers atArrangedObjectIndexes:indices]; }]; @@ -572,7 +572,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio [self continueWorldTourWithRemainingAnnotations:annotations]; } -- (void)continueWorldTourWithRemainingAnnotations:(NS_MUTABLE_ARRAY_OF(MGLPointAnnotation *) *)annotations { +- (void)continueWorldTourWithRemainingAnnotations:(NSMutableArray<MGLPointAnnotation *> *)annotations { MGLPointAnnotation *nextAnnotation = annotations.firstObject; if (!nextAnnotation || !_isTouringWorld) { _isTouringWorld = NO; @@ -1236,7 +1236,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio #pragma mark NSSharingServicePickerDelegate methods -- (NS_ARRAY_OF(NSSharingService *) *)sharingServicePicker:(NSSharingServicePicker *)sharingServicePicker sharingServicesForItems:(NSArray *)items proposedSharingServices:(NS_ARRAY_OF(NSSharingService *) *)proposedServices { +- (NSArray<NSSharingService *> *)sharingServicePicker:(NSSharingServicePicker *)sharingServicePicker sharingServicesForItems:(NSArray *)items proposedSharingServices:(NSArray<NSSharingService *> *)proposedServices { NSURL *shareURL = self.shareURL; NSURL *browserURL = [[NSWorkspace sharedWorkspace] URLForApplicationToOpenURL:shareURL]; NSImage *browserIcon = [[NSWorkspace sharedWorkspace] iconForFile:browserURL.path]; diff --git a/platform/macos/docs/doc-README.md b/platform/macos/docs/doc-README.md index 8089ae17d1..8ce2df39a4 100644 --- a/platform/macos/docs/doc-README.md +++ b/platform/macos/docs/doc-README.md @@ -1,6 +1,6 @@ # [Mapbox Maps SDK for macOS](https://github.com/mapbox/mapbox-gl-native/tree/master/platform/macos/) -The Mapbox Maps SDK for macOS is an open-source framework for embedding interactive map views with scalable, customizable vector maps into Cocoa applications on macOS 10.10.0 and above using Objective-C, Swift, Interface Builder, or AppleScript. The SDK takes stylesheets that conform to the [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/), applies them to vector tiles that conform to the [Mapbox Vector Tile Specification](https://www.mapbox.com/developers/vector-tiles/), and renders them using OpenGL. +The Mapbox Maps SDK for macOS is an open-source framework for embedding interactive map views with scalable, customizable vector maps into Cocoa applications on macOS 10.11.0 and above using Objective-C, Swift, Interface Builder, or AppleScript. The SDK takes stylesheets that conform to the [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/), applies them to vector tiles that conform to the [Mapbox Vector Tile Specification](https://www.mapbox.com/developers/vector-tiles/), and renders them using OpenGL. ![](img/screenshot.jpg) diff --git a/platform/macos/docs/pod-README.md b/platform/macos/docs/pod-README.md index 97e77673ee..4827124be0 100644 --- a/platform/macos/docs/pod-README.md +++ b/platform/macos/docs/pod-README.md @@ -10,7 +10,7 @@ Put interactive, scalable world maps into your native Cocoa application with the ![](https://raw.githubusercontent.com/mapbox/mapbox-gl-native/master/platform/macos/docs/img/screenshot.jpg) -The Mapbox Maps SDK for macOS is compatible with macOS 10.10.0 and above for Cocoa applications developed in Objective-C, Swift, Interface Builder, or AppleScript. For hybrid applications, consider [Mapbox GL JS](https://www.mapbox.com/mapbox-gl-js/). +The Mapbox Maps SDK for macOS is compatible with macOS 10.11.0 and above for Cocoa applications developed in Objective-C, Swift, Interface Builder, or AppleScript. For hybrid applications, consider [Mapbox GL JS](https://www.mapbox.com/mapbox-gl-js/). ## Installation @@ -37,7 +37,7 @@ After running `carthage update`, you’ll find Mapbox.framework in the Carthage/ Create a [Podfile](https://guides.cocoapods.org/syntax/podfile.html) with the following specification: ```rb -platform :osx, '10.10' +platform :osx, '10.11' target 'TargetNameForYourApp' do pod 'Mapbox-iOS-SDK', '~> x.y' diff --git a/platform/macos/macos.xcodeproj/project.pbxproj b/platform/macos/macos.xcodeproj/project.pbxproj index d49e5e6f06..002590d8ff 100644 --- a/platform/macos/macos.xcodeproj/project.pbxproj +++ b/platform/macos/macos.xcodeproj/project.pbxproj @@ -1816,7 +1816,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.10; + MACOSX_DEPLOYMENT_TARGET = 10.11; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SYMROOT = "$(PROJECT_DIR)/cmake"; @@ -1867,7 +1867,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.10; + MACOSX_DEPLOYMENT_TARGET = 10.11; MTL_ENABLE_DEBUG_INFO = NO; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SYMROOT = "$(PROJECT_DIR)/cmake"; diff --git a/platform/macos/src/MGLMapView+IBAdditions.mm b/platform/macos/src/MGLMapView+IBAdditions.mm index eada47ef90..cef2863ee6 100644 --- a/platform/macos/src/MGLMapView+IBAdditions.mm +++ b/platform/macos/src/MGLMapView+IBAdditions.mm @@ -4,7 +4,7 @@ @implementation MGLMapView (IBAdditions) -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingStyleURL__ { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingStyleURL__ { return [NSSet setWithObject:@"styleURL"]; } @@ -23,7 +23,7 @@ self.styleURL = url; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingLatitude { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingLatitude { return [NSSet setWithObjects:@"centerCoordinate", @"camera", nil]; } @@ -45,7 +45,7 @@ } } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingLongitude { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingLongitude { return [NSSet setWithObjects:@"centerCoordinate", @"camera", nil]; } @@ -67,7 +67,7 @@ } } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingAllowsZooming { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingAllowsZooming { return [NSSet setWithObject:@"zoomEnabled"]; } @@ -79,7 +79,7 @@ self.zoomEnabled = allowsZooming; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingAllowsScrolling { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingAllowsScrolling { return [NSSet setWithObject:@"scrollEnabled"]; } @@ -91,7 +91,7 @@ self.scrollEnabled = allowsScrolling; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingAllowsRotating { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingAllowsRotating { return [NSSet setWithObject:@"rotateEnabled"]; } @@ -103,7 +103,7 @@ self.rotateEnabled = allowsRotating; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingAllowsTilting { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingAllowsTilting { return [NSSet setWithObject:@"pitchEnabled"]; } diff --git a/platform/macos/src/MGLMapView.h b/platform/macos/src/MGLMapView.h index e3de1069a9..824df827ac 100644 --- a/platform/macos/src/MGLMapView.h +++ b/platform/macos/src/MGLMapView.h @@ -443,7 +443,7 @@ MGL_EXPORT IB_DESIGNABLE @param animated `YES` if you want the map region change to be animated, or `NO` if you want the map to display the new region immediately without animations. */ -- (void)showAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations animated:(BOOL)animated; +- (void)showAnnotations:(NSArray<id <MGLAnnotation>> *)annotations animated:(BOOL)animated; /** Sets the visible region so that the map displays the specified annotations with @@ -458,7 +458,7 @@ MGL_EXPORT IB_DESIGNABLE @param animated `YES` if you want the map region change to be animated, or `NO` if you want the map to display the new region immediately without animations. */ -- (void)showAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations edgePadding:(NSEdgeInsets)insets animated:(BOOL)animated; +- (void)showAnnotations:(NSArray<id <MGLAnnotation>> *)annotations edgePadding:(NSEdgeInsets)insets animated:(BOOL)animated; /** Returns the camera that best fits the given coordinate bounds. @@ -621,7 +621,7 @@ MGL_EXPORT IB_DESIGNABLE annotations are associated with the map view, the value of this property is `nil`. */ -@property (nonatomic, readonly, nullable) NS_ARRAY_OF(id <MGLAnnotation>) *annotations; +@property (nonatomic, readonly, nullable) NSArray<id <MGLAnnotation>> *annotations; /** Adds an annotation to the map view. @@ -651,7 +651,7 @@ MGL_EXPORT IB_DESIGNABLE must conform to the `MGLAnnotation` protocol. The map view retains each individual annotation object. */ -- (void)addAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations; +- (void)addAnnotations:(NSArray<id <MGLAnnotation>> *)annotations; /** The complete list of annotations associated with the receiver that are @@ -661,7 +661,7 @@ MGL_EXPORT IB_DESIGNABLE annotations are associated with the map view or if no annotations associated with the map view are currently visible, the value of this property is `nil`. */ -@property (nonatomic, readonly, nullable) NS_ARRAY_OF(id <MGLAnnotation>) *visibleAnnotations; +@property (nonatomic, readonly, nullable) NSArray<id <MGLAnnotation>> *visibleAnnotations; /** Removes an annotation from the map view, deselecting it if it is selected. @@ -686,7 +686,7 @@ MGL_EXPORT IB_DESIGNABLE @param annotations The array of annotation objects to remove. Objects in the array must conform to the `MGLAnnotation` protocol. */ -- (void)removeAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations; +- (void)removeAnnotations:(NSArray<id <MGLAnnotation>> *)annotations; /** Returns a reusable annotation image object associated with its identifier. @@ -712,7 +712,7 @@ MGL_EXPORT IB_DESIGNABLE no annotations associated with the map view are currently visible in the rectangle. */ -- (nullable NS_ARRAY_OF(id <MGLAnnotation>) *)visibleAnnotationsInRect:(CGRect)rect; +- (nullable NSArray<id <MGLAnnotation>> *)visibleAnnotationsInRect:(CGRect)rect; #pragma mark Managing Annotation Selections @@ -729,7 +729,7 @@ MGL_EXPORT IB_DESIGNABLE @note In versions prior to `4.0.0` if the annotation was offscreen it was not selected. */ -@property (nonatomic, copy) NS_ARRAY_OF(id <MGLAnnotation>) *selectedAnnotations; +@property (nonatomic, copy) NSArray<id <MGLAnnotation>> *selectedAnnotations; /** Selects an annotation and displays a callout popover for it. @@ -791,7 +791,7 @@ MGL_EXPORT IB_DESIGNABLE overlays are associated with the map view, the value of this property is empty array. */ -@property (nonatomic, readonly, nonnull) NS_ARRAY_OF(id <MGLOverlay>) *overlays; +@property (nonatomic, readonly, nonnull) NSArray<id <MGLOverlay>> *overlays; /** Adds a single overlay to the map. @@ -811,7 +811,7 @@ MGL_EXPORT IB_DESIGNABLE @param overlays An array of objects, each of which must conform to the `MGLOverlay` protocol. */ -- (void)addOverlays:(NS_ARRAY_OF(id <MGLOverlay>) *)overlays; +- (void)addOverlays:(NSArray<id <MGLOverlay>> *)overlays; /** Removes a single overlay from the map. @@ -831,7 +831,7 @@ MGL_EXPORT IB_DESIGNABLE @param overlays An array of objects, each of which conforms to the `MGLOverlay` protocol. */ -- (void)removeOverlays:(NS_ARRAY_OF(id <MGLOverlay>) *)overlays; +- (void)removeOverlays:(NSArray<id <MGLOverlay>> *)overlays; #pragma mark Accessing the Underlying Map Data @@ -847,7 +847,7 @@ MGL_EXPORT IB_DESIGNABLE @return An array of objects conforming to the `MGLFeature` protocol that represent features in the sources used by the current style. */ -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesAtPoint:(NSPoint)point NS_SWIFT_NAME(visibleFeatures(at:)); +- (NSArray<id <MGLFeature>> *)visibleFeaturesAtPoint:(NSPoint)point NS_SWIFT_NAME(visibleFeatures(at:)); /** Returns an array of rendered map features that intersect with a given point, @@ -866,7 +866,7 @@ MGL_EXPORT IB_DESIGNABLE @return An array of objects conforming to the `MGLFeature` protocol that represent features in the sources used by the current style. */ -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesAtPoint:(NSPoint)point inStyleLayersWithIdentifiers:(nullable NS_SET_OF(NSString *) *)styleLayerIdentifiers NS_SWIFT_NAME(visibleFeatures(at:styleLayerIdentifiers:)); +- (NSArray<id <MGLFeature>> *)visibleFeaturesAtPoint:(NSPoint)point inStyleLayersWithIdentifiers:(nullable NSSet<NSString *> *)styleLayerIdentifiers NS_SWIFT_NAME(visibleFeatures(at:styleLayerIdentifiers:)); /** Returns an array of rendered map features that intersect with a given point, @@ -928,7 +928,7 @@ MGL_EXPORT IB_DESIGNABLE @return An array of objects conforming to the `MGLFeature` protocol that represent features in the sources used by the current style. */ -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesAtPoint:(NSPoint)point inStyleLayersWithIdentifiers:(nullable NS_SET_OF(NSString *) *)styleLayerIdentifiers predicate:(nullable NSPredicate *)predicate NS_SWIFT_NAME(visibleFeatures(at:styleLayerIdentifiers:predicate:)); +- (NSArray<id <MGLFeature>> *)visibleFeaturesAtPoint:(NSPoint)point inStyleLayersWithIdentifiers:(nullable NSSet<NSString *> *)styleLayerIdentifiers predicate:(nullable NSPredicate *)predicate NS_SWIFT_NAME(visibleFeatures(at:styleLayerIdentifiers:predicate:)); /** Returns an array of rendered map features that intersect with the given @@ -943,7 +943,7 @@ MGL_EXPORT IB_DESIGNABLE @return An array of objects conforming to the `MGLFeature` protocol that represent features in the sources used by the current style. */ -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesInRect:(NSRect)rect NS_SWIFT_NAME(visibleFeatures(in:)); +- (NSArray<id <MGLFeature>> *)visibleFeaturesInRect:(NSRect)rect NS_SWIFT_NAME(visibleFeatures(in:)); /** Returns an array of rendered map features that intersect with the given @@ -962,7 +962,7 @@ MGL_EXPORT IB_DESIGNABLE @return An array of objects conforming to the `MGLFeature` protocol that represent features in the sources used by the current style. */ -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesInRect:(NSRect)rect inStyleLayersWithIdentifiers:(nullable NS_SET_OF(NSString *) *)styleLayerIdentifiers NS_SWIFT_NAME(visibleFeatures(at:styleLayerIdentifiers:)); +- (NSArray<id <MGLFeature>> *)visibleFeaturesInRect:(NSRect)rect inStyleLayersWithIdentifiers:(nullable NSSet<NSString *> *)styleLayerIdentifiers NS_SWIFT_NAME(visibleFeatures(at:styleLayerIdentifiers:)); /** Returns an array of rendered map features that intersect with the given @@ -1026,7 +1026,7 @@ MGL_EXPORT IB_DESIGNABLE @return An array of objects conforming to the `MGLFeature` protocol that represent features in the sources used by the current style. */ -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesInRect:(NSRect)rect inStyleLayersWithIdentifiers:(nullable NS_SET_OF(NSString *) *)styleLayerIdentifiers predicate:(nullable NSPredicate *)predicate NS_SWIFT_NAME(visibleFeatures(in:styleLayerIdentifiers:predicate:)); +- (NSArray<id <MGLFeature>> *)visibleFeaturesInRect:(NSRect)rect inStyleLayersWithIdentifiers:(nullable NSSet<NSString *> *)styleLayerIdentifiers predicate:(nullable NSPredicate *)predicate NS_SWIFT_NAME(visibleFeatures(in:styleLayerIdentifiers:predicate:)); #pragma mark Converting Geographic Coordinates diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index 9cab9a76da..42fd24653e 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -149,7 +149,7 @@ public: @property (nonatomic, readwrite) MGLStyle *style; /// Mapping from reusable identifiers to annotation images. -@property (nonatomic) NS_MUTABLE_DICTIONARY_OF(NSString *, MGLAnnotationImage *) *annotationImagesByIdentifier; +@property (nonatomic) NSMutableDictionary<NSString *, MGLAnnotationImage *> *annotationImagesByIdentifier; /// Currently shown popover representing the selected annotation. @property (nonatomic) NSPopover *calloutForSelectedAnnotation; @@ -611,7 +611,7 @@ public: #pragma mark Style -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingStyle { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingStyle { return [NSSet setWithObject:@"styleURL"]; } @@ -965,7 +965,7 @@ public: #pragma mark Viewport -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingCenterCoordinate { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingCenterCoordinate { return [NSSet setWithObjects:@"latitude", @"longitude", @"camera", nil]; } @@ -1015,7 +1015,7 @@ public: _pendingLongitude = pendingLongitude; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingZoomLevel { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingZoomLevel { return [NSSet setWithObject:@"camera"]; } @@ -1083,7 +1083,7 @@ public: } } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingDirection { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingDirection { return [NSSet setWithObject:@"camera"]; } @@ -1107,7 +1107,7 @@ public: [self setDirection:_mbglMap->getBearing() + delta animated:animated]; } -+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingCamera { ++ (NSSet<NSString *> *)keyPathsForValuesAffectingCamera { return [NSSet setWithObjects:@"latitude", @"longitude", @"centerCoordinate", @"zoomLevel", @"direction", nil]; } @@ -1765,7 +1765,7 @@ public: #pragma mark Annotations -- (nullable NS_ARRAY_OF(id <MGLAnnotation>) *)annotations { +- (nullable NSArray<id <MGLAnnotation>> *)annotations { if (_annotationContextsByAnnotationTag.empty()) { return nil; } @@ -1781,12 +1781,12 @@ public: return [NSArray arrayWithObjects:&annotations[0] count:annotations.size()]; } -- (nullable NS_ARRAY_OF(id <MGLAnnotation>) *)visibleAnnotations +- (nullable NSArray<id <MGLAnnotation>> *)visibleAnnotations { return [self visibleFeaturesInRect:self.bounds]; } -- (nullable NS_ARRAY_OF(id <MGLAnnotation>) *)visibleAnnotationsInRect:(CGRect)rect +- (nullable NSArray<id <MGLAnnotation>> *)visibleAnnotationsInRect:(CGRect)rect { if (_annotationContextsByAnnotationTag.empty()) { @@ -1852,7 +1852,7 @@ public: } } -- (void)addAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations { +- (void)addAnnotations:(NSArray<id <MGLAnnotation>> *)annotations { if (!annotations) { return; } @@ -1987,7 +1987,7 @@ public: } } -- (void)removeAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations { +- (void)removeAnnotations:(NSArray<id <MGLAnnotation>> *)annotations { if (!annotations) { return; } @@ -2192,12 +2192,12 @@ public: [self didChangeValueForKey:@"selectedAnnotations"]; } -- (NS_ARRAY_OF(id <MGLAnnotation>) *)selectedAnnotations { +- (NSArray<id <MGLAnnotation>> *)selectedAnnotations { id <MGLAnnotation> selectedAnnotation = self.selectedAnnotation; return selectedAnnotation ? @[selectedAnnotation] : @[]; } -- (void)setSelectedAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)selectedAnnotations { +- (void)setSelectedAnnotations:(NSArray<id <MGLAnnotation>> *)selectedAnnotations { if (!selectedAnnotations.count) { return; } @@ -2330,7 +2330,7 @@ public: } } -- (void)showAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations animated:(BOOL)animated { +- (void)showAnnotations:(NSArray<id <MGLAnnotation>> *)annotations animated:(BOOL)animated { CGFloat maximumPadding = 100; CGFloat yPadding = (NSHeight(self.bounds) / 5 <= maximumPadding) ? (NSHeight(self.bounds) / 5) : maximumPadding; CGFloat xPadding = (NSWidth(self.bounds) / 5 <= maximumPadding) ? (NSWidth(self.bounds) / 5) : maximumPadding; @@ -2340,7 +2340,7 @@ public: [self showAnnotations:annotations edgePadding:edgeInsets animated:animated]; } -- (void)showAnnotations:(NS_ARRAY_OF(id <MGLAnnotation>) *)annotations edgePadding:(NSEdgeInsets)insets animated:(BOOL)animated { +- (void)showAnnotations:(NSArray<id <MGLAnnotation>> *)annotations edgePadding:(NSEdgeInsets)insets animated:(BOOL)animated { if ( ! annotations || ! annotations.count) return; mbgl::LatLngBounds bounds = mbgl::LatLngBounds::empty(); @@ -2537,11 +2537,11 @@ public: #pragma mark Overlays -- (nonnull NS_ARRAY_OF(id <MGLOverlay>) *)overlays +- (nonnull NSArray<id <MGLOverlay>> *)overlays { if (self.annotations == nil) { return @[]; } - NS_MUTABLE_ARRAY_OF(id <MGLOverlay>) *mutableOverlays = [NSMutableArray array]; + NSMutableArray<id <MGLOverlay>> *mutableOverlays = [NSMutableArray array]; [self.annotations enumerateObjectsUsingBlock:^(id<MGLAnnotation> _Nonnull annotation, NSUInteger idx, BOOL * _Nonnull stop) { if ([annotation conformsToProtocol:@protocol(MGLOverlay)]) @@ -2557,7 +2557,7 @@ public: [self addOverlays:@[overlay]]; } -- (void)addOverlays:(NS_ARRAY_OF(id <MGLOverlay>) *)overlays +- (void)addOverlays:(NSArray<id <MGLOverlay>> *)overlays { #if DEBUG for (id <MGLOverlay> overlay in overlays) { @@ -2571,7 +2571,7 @@ public: [self removeOverlays:@[overlay]]; } -- (void)removeOverlays:(NS_ARRAY_OF(id <MGLOverlay>) *)overlays { +- (void)removeOverlays:(NSArray<id <MGLOverlay>> *)overlays { #if DEBUG for (id <MGLOverlay> overlay in overlays) { NSAssert([overlay conformsToProtocol:@protocol(MGLOverlay)], @"Overlay does not conform to MGLOverlay"); @@ -2652,15 +2652,15 @@ public: #pragma mark Data -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesAtPoint:(NSPoint)point { +- (NSArray<id <MGLFeature>> *)visibleFeaturesAtPoint:(NSPoint)point { return [self visibleFeaturesAtPoint:point inStyleLayersWithIdentifiers:nil]; } -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesAtPoint:(CGPoint)point inStyleLayersWithIdentifiers:(NS_SET_OF(NSString *) *)styleLayerIdentifiers { +- (NSArray<id <MGLFeature>> *)visibleFeaturesAtPoint:(CGPoint)point inStyleLayersWithIdentifiers:(NSSet<NSString *> *)styleLayerIdentifiers { return [self visibleFeaturesAtPoint:point inStyleLayersWithIdentifiers:styleLayerIdentifiers predicate:nil]; } -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesAtPoint:(NSPoint)point inStyleLayersWithIdentifiers:(NS_SET_OF(NSString *) *)styleLayerIdentifiers predicate:(NSPredicate *)predicate { +- (NSArray<id <MGLFeature>> *)visibleFeaturesAtPoint:(NSPoint)point inStyleLayersWithIdentifiers:(NSSet<NSString *> *)styleLayerIdentifiers predicate:(NSPredicate *)predicate { // Cocoa origin is at the lower-left corner. mbgl::ScreenCoordinate screenCoordinate = { point.x, NSHeight(self.bounds) - point.y }; @@ -2683,15 +2683,15 @@ public: return MGLFeaturesFromMBGLFeatures(features); } -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesInRect:(NSRect)rect { +- (NSArray<id <MGLFeature>> *)visibleFeaturesInRect:(NSRect)rect { return [self visibleFeaturesInRect:rect inStyleLayersWithIdentifiers:nil]; } -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesInRect:(CGRect)rect inStyleLayersWithIdentifiers:(NS_SET_OF(NSString *) *)styleLayerIdentifiers { +- (NSArray<id <MGLFeature>> *)visibleFeaturesInRect:(CGRect)rect inStyleLayersWithIdentifiers:(NSSet<NSString *> *)styleLayerIdentifiers { return [self visibleFeaturesInRect:rect inStyleLayersWithIdentifiers:styleLayerIdentifiers predicate:nil]; } -- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesInRect:(NSRect)rect inStyleLayersWithIdentifiers:(NS_SET_OF(NSString *) *)styleLayerIdentifiers predicate:(NSPredicate *)predicate { +- (NSArray<id <MGLFeature>> *)visibleFeaturesInRect:(NSRect)rect inStyleLayersWithIdentifiers:(NSSet<NSString *> *)styleLayerIdentifiers predicate:(NSPredicate *)predicate { // Cocoa origin is at the lower-left corner. mbgl::ScreenBox screenBox = { { NSMinX(rect), NSHeight(self.bounds) - NSMaxY(rect) }, |