Skip to content

Commit

Permalink
Last changes before Metal release (#2024)
Browse files Browse the repository at this point in the history
  • Loading branch information
louwers authored Jan 16, 2024
1 parent 7479d8c commit f1cdc20
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ios-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 13 additions & 0 deletions platform/ios/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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"],
)
Expand Down
5 changes: 2 additions & 3 deletions platform/ios/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
25 changes: 0 additions & 25 deletions platform/ios/app/MBXViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -118,7 +113,6 @@ typedef NS_ENUM(NSInteger, MBXSettingsRuntimeStylingRows) {
};

typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
MBXSettingsMiscellaneousLatLngBoundsConstraints,
MBXSettingsMiscellaneousWorldTour,
MBXSettingsMiscellaneousRandomTour,
MBXSettingsMiscellaneousScrollView,
Expand Down Expand Up @@ -248,7 +242,6 @@ @implementation MBXViewController
BOOL _isTouringWorld;
BOOL _contentInsetsEnabled;
UIEdgeInsets _originalContentInsets;
BOOL _hasLatLngBoundConstraints;
}

// MARK: - Setup & Teardown
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -689,9 +681,6 @@ - (void)performActionForSettingAtIndexPath:(NSIndexPath *)indexPath
case MBXSettingsMiscellaneous:
switch (indexPath.row)
{
case MBXSettingsMiscellaneousLatLngBoundsConstraints:
[self setLatLngBoundsConstraints];
break;
case MBXSettingsMiscellaneousLocalizeLabels:
[self toggleStyleLabelsLanguage];
break;
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 0 additions & 12 deletions platform/ios/src/MLNMapView.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
18 changes: 0 additions & 18 deletions platform/ios/src/MLNMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2695,7 +2695,6 @@ - (MLNMapCamera *)cameraByZoomingToZoomLevel:(double)zoom aroundAnchorPoint:(CGP
currentCameraOptions.anchor = anchor;
MLNCoordinateBounds bounds = MLNCoordinateBoundsFromLatLngBounds(self.mbglMap.latLngBoundsForCamera(currentCameraOptions));


return [self cameraThatFitsCoordinateBounds:bounds];
}

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f1cdc20

Please sign in to comment.