diff --git a/.github/workflows/ios-ci.yml b/.github/workflows/ios-ci.yml index c79bb85b735..cb595dc2bd1 100644 --- a/.github/workflows/ios-ci.yml +++ b/.github/workflows/ios-ci.yml @@ -208,7 +208,7 @@ jobs: - name: Build XCFramework run: | - bazel build --compilation_mode=opt --//:renderer=metal --//:maplibre_platform=ios //platform/ios:MapLibre.dynamic + bazel build --compilation_mode=opt --//:renderer=metal --//:maplibre_platform=ios //platform/ios:MapLibre.dynamic --embed_label=maplibre_ios_"$(cat VERSION)" echo xcframework="$(bazel info execution_root)"/"$(bazel cquery --output=files --compilation_mode=opt --//:renderer=metal --//:maplibre_platform=ios //platform/ios:MapLibre.dynamic)" >> "$GITHUB_ENV" - name: Get version (release) diff --git a/platform/ios/BUILD.bazel b/platform/ios/BUILD.bazel index f6869eb4251..146f3ea3289 100644 --- a/platform/ios/BUILD.bazel +++ b/platform/ios/BUILD.bazel @@ -1,6 +1,7 @@ load("@build_bazel_rules_apple//apple:apple.bzl", "apple_static_xcframework", "apple_xcframework") load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application", "ios_framework") load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") +load("@build_bazel_rules_apple//apple:versioning.bzl", "apple_bundle_version") load( "@rules_xcodeproj//xcodeproj:defs.bzl", "top_level_target", @@ -120,6 +121,17 @@ apple_static_xcframework( deps = ["//platform:ios-sdk"], ) +apple_bundle_version( + name = "maplibre_ios_version", + build_label_pattern = "maplibre_ios_{version}", + build_version = "{version}", + capture_groups = { + "version": "[0-9]+.[0-9]+.[0-9]+", + }, + fallback_build_label = "maplibre_ios_1.2.3456789", + short_version_string = "{version}", +) + apple_xcframework( name = "MapLibre.dynamic", bundle_id = "com.maplibre.mapbox", @@ -139,6 +151,7 @@ apple_xcframework( minimum_os_versions = {"ios": "12.0"}, public_hdrs = public_hdrs, umbrella_header = "umbrella_header", + version = ":maplibre_ios_version", visibility = ["//visibility:public"], deps = ["//platform:ios-sdk-dynamic"], ) diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 04775a902dc..824732d36c8 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -8,14 +8,13 @@ MapLibre welcomes participation and contributions from everyone. Please read [`C * This is the first release that uses **Metal** for rendering. This is a graphics API from Apple that replaces OpenGL ES on Apple platforms. * Note that the [snapshotter](https://github.com/maplibre/maplibre-native/issues/1862) has not been implemented yet for the Metal renderer. Hold off updating if your application requires this functionality. - * While we had a long period of pre-releases and testing leading up to this release, and no crashes have been reported, it is possible that you come across inconsistencies or problems in production apps. Please report them on [GitHub](https://github.com/maplibre/maplibre-native/issues/1609). + * While we had a long period of pre-releases and testing leading up to this release, and no crashes have been reported, it is possible that you come across inconsistencies or problems in production apps. Please report them on GitHub. * 💥 Breaking: Changed the prefix of files, classes, methods, variables and everything from `MGL` to `MLN`. ([#919](https://github.com/maplibre/maplibre-native/pull/919)). > To migrate: > Change all your `MGL` prefixes to `MLN`. If you are using `NSKeyedArchiver` or similar mechanishm to save the state, the app may crash after this change when trying to unarchive the state using old names of the classes. You need to clean the saved state of the app and save it using new classes. * 💥 Breaking: The OpenGL ES renderer now uses OpenGL ES 3.0. This means that only iOS Devices with an Apple A7 GPU or later are supported. https://developer.apple.com/library/archive/documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/BestPracticesforAppleA7GPUsandLater/BestPracticesforAppleA7GPUsandLater.html -* Add `MLNMapView.setLatLngBounds` and `MLNMapView.clearLatLnBounds` -* Add `flyToCamera` with `edgePadding` for `MLNMapView` +* The Swift package needs to be imported with `import MapLibre` instead of `import Mapbox`. ## 5.13.0 - January 05, 2023 diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index 1eb9f60fe04..fa94621cc7a 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -38,11 +38,6 @@ .ne = { .latitude = 40.989329, .longitude = -102.062592}, }; -static const MLNCoordinateBounds areaAroundBelgium = { - .sw = { .latitude = 52.2782, .longitude = 8.289179999999988}, - .ne = { .latitude = 48.5584, .longitude = 1.0162300000000073}, -}; - static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXViewControllerAnnotationViewReuseIdentifer"; typedef NS_ENUM(NSInteger, MBXSettingsSections) { @@ -118,7 +113,6 @@ typedef NS_ENUM(NSInteger, MBXSettingsRuntimeStylingRows) { }; typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { - MBXSettingsMiscellaneousLatLngBoundsConstraints, MBXSettingsMiscellaneousWorldTour, MBXSettingsMiscellaneousRandomTour, MBXSettingsMiscellaneousScrollView, @@ -248,7 +242,6 @@ @implementation MBXViewController BOOL _isTouringWorld; BOOL _contentInsetsEnabled; UIEdgeInsets _originalContentInsets; - BOOL _hasLatLngBoundConstraints; } // MARK: - Setup & Teardown @@ -455,7 +448,6 @@ - (void)dismissSettings:(__unused id)sender break; case MBXSettingsMiscellaneous: [settingsTitles addObjectsFromArray:@[ - _hasLatLngBoundConstraints ? @"Remove LatLng bound constraints" : @"Set LatLng bound box constraint", @"Start World Tour", @"Random Tour", @"Embedded Map View", @@ -689,9 +681,6 @@ - (void)performActionForSettingAtIndexPath:(NSIndexPath *)indexPath case MBXSettingsMiscellaneous: switch (indexPath.row) { - case MBXSettingsMiscellaneousLatLngBoundsConstraints: - [self setLatLngBoundsConstraints]; - break; case MBXSettingsMiscellaneousLocalizeLabels: [self toggleStyleLabelsLanguage]; break; @@ -1506,20 +1495,6 @@ - (void)updateAnimatedImageSource:(NSTimer *)timer { } } --(void)setLatLngBoundsConstraints -{ - if(_hasLatLngBoundConstraints) { - [self.mapView clearLatLnBounds]; - [self.mapView resetPosition]; - } else { - MLNMapCamera *newCamera = [self.mapView cameraThatFitsCoordinateBounds: areaAroundBelgium]; - [self.mapView setCamera: newCamera]; - [self.mapView setLatLngBounds: areaAroundBelgium]; - } - - _hasLatLngBoundConstraints = !_hasLatLngBoundConstraints; -} - -(void)toggleStyleLabelsLanguage { _localizingLabels = !_localizingLabels; diff --git a/platform/ios/src/MLNMapView.h b/platform/ios/src/MLNMapView.h index ddeb9bb6e46..d0daffcca28 100644 --- a/platform/ios/src/MLNMapView.h +++ b/platform/ios/src/MLNMapView.h @@ -1383,18 +1383,6 @@ MLN_EXPORT */ - (CGPoint)anchorPointForGesture:(UIGestureRecognizer *)gesture; - -/** - * Sets a LatLngBounds that constraints map transformations to this bounds. - * @param latLngBounds the bounds to constrain the map with - */ -- (void)setLatLngBounds:(MLNCoordinateBounds)latLngBounds; - -/** - * Clears the bounds that were set via `setLatLngBounds` - */ -- (void)clearLatLnBounds; - /** The distance from the edges of the map view’s frame to the edges of the map view’s logical viewport. diff --git a/platform/ios/src/MLNMapView.mm b/platform/ios/src/MLNMapView.mm index ef0e4ff6fd7..196284ad7d6 100644 --- a/platform/ios/src/MLNMapView.mm +++ b/platform/ios/src/MLNMapView.mm @@ -2695,7 +2695,6 @@ - (MLNMapCamera *)cameraByZoomingToZoomLevel:(double)zoom aroundAnchorPoint:(CGP currentCameraOptions.anchor = anchor; MLNCoordinateBounds bounds = MLNCoordinateBoundsFromLatLngBounds(self.mbglMap.latLngBoundsForCamera(currentCameraOptions)); - return [self cameraThatFitsCoordinateBounds:bounds]; } @@ -3834,23 +3833,6 @@ - (void)setMinimumZoomLevel:(double)minimumZoomLevel self.mbglMap.setBounds(mbgl::BoundOptions().withMinZoom(minimumZoomLevel)); } - - -- (void)clearLatLnBounds -{ - mbgl::BoundOptions newBounds = mbgl::BoundOptions().withLatLngBounds(mbgl::LatLngBounds()); - self.mbglMap.setBounds(newBounds); -} - -- (void)setLatLngBounds:(MLNCoordinateBounds)latLngBounds -{ - mbgl::LatLng sw = {latLngBounds.sw.latitude, latLngBounds.sw.longitude}; - mbgl::LatLng ne = {latLngBounds.ne.latitude, latLngBounds.ne.longitude}; - mbgl::BoundOptions newBounds = mbgl::BoundOptions().withLatLngBounds(mbgl::LatLngBounds::hull(sw, ne)); - - self.mbglMap.setBounds(newBounds); -} - - (double)minimumZoomLevel { return *self.mbglMap.getBounds().minZoom;