Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support defining a custom style layer from iOS Swift #3154

Merged
merged 8 commits into from
Jan 22, 2025

Conversation

christian-boks
Copy link
Contributor

I wanted to use a custom style layer in a Swift app on iOS, but discovered that the typedef struct MLNBackendResource structure used to expose the backend wasn't visible in Swift, so I converted it to an Objective-c interface.

And I've also converted the Objective-c example to Swift and added it to the Swift example app, to show how to use it.

Copy link
Collaborator

@louwers louwers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks this is awesome!

Got it to compile with the OpenGL backend too.

We're not really supporting that anymore, but I guess it doesn't hurt.

This example doesn't work when I rotate the map. But that can be addressed in a follow-up PR.

I think this is technically a breaking change, but since custom style layers are a somewhat experimental feature I think it is acceptable.

@christian-boks
Copy link
Contributor Author

Thanks this is awesome!

Got it to compile with the OpenGL backend too.

We're not really supporting that anymore, but I guess it doesn't hurt.

It looks like there is a CI step that still compiles the code without the --//:renderer=metal option tough.

This example doesn't work when I rotate the map. But that can be addressed in a follow-up PR.

I see what you mean, I had just tested it on the simulator before. I guess I need to rotate the matrix too, not just scale it.

I think this is technically a breaking change, but since custom style layers are a somewhat experimental feature I think it is acceptable.

👍

@louwers
Copy link
Collaborator

louwers commented Jan 21, 2025

It looks like there is a CI step that still compiles the code without the --//:renderer=metal option tough.

Oh wow, that is an oversight. I will fix that.

@stefankarschti
Copy link
Collaborator

This example doesn't work when I rotate the map. But that can be addressed in a follow-up PR

I think that's fine, the original example didn't implement the projection matrix either.

@louwers louwers enabled auto-merge (squash) January 21, 2025 17:59
auto-merge was automatically disabled January 21, 2025 20:15

Head branch was pushed to by a user without write access

Copy link

Bloaty Results (iOS) 🐋

Compared to main

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0% +2.46Ki  [ = ]       0    TOTAL

Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results-ios/pr-3154-compared-to-main.txt

@louwers louwers merged commit a69c5dc into maplibre:main Jan 22, 2025
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants