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

Add SwiftUI & Playground for testing Metal support #65

Merged
merged 7 commits into from
May 5, 2021
Merged

Add SwiftUI & Playground for testing Metal support #65

merged 7 commits into from
May 5, 2021

Conversation

roblabs
Copy link
Collaborator

@roblabs roblabs commented Apr 16, 2021

This commit has Test apps for:

  • MapLibre Playground
  • SwiftUI demo app

The MapLibre repo now has a Swift Playground that allows you to change the style and play around with a very simple rendered map.


MapLibre Playground


MapLibre Swift UI

@@ -145,9 +140,18 @@ responder.mapView = mapView
let tapGesture = UILongPressGestureRecognizer(target: mapDelegate, action: #selector(mapDelegate.handleTap))
mapView.addGestureRecognizer(tapGesture)

//: Set Style
let styleJSON = "https://raw.githubusercontent.com/roblabs/openmaptiles-ios-demo/master/OSM2VectorTiles/styles/geography-class.GitHub.json"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible to move this styleJSON to this repo?

Copy link
Contributor

Choose a reason for hiding this comment

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

We are working on MapLibre website which will host zero-configuration style and vector tiles. It should be ready in 2-4 weeks. I would suggest to use the style from there when it is ready.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm already introducing hard coded styles, which will need to be unraveled.

In a separate branch specific to work on styles, we'll need to do some maintenance & populating of style URLs in the class MGLStyle. Then in the future we can have custom MapLibre styles usable as

let style  = MGLStyle.geographyClassURL
// or
let style2 = MGLStyle.zeroConfURL

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is it possible to move this styleJSON to this repo?

Good question. By chance, the style and tile data this points to are .pbf/protobuf files, already served up by github.com. If we were to commit tile data, it may be better to go the route of having .mbtiles from OpenMapTile.org


struct ContentView: View {
var body: some View {
MapView(style: "https://raw.githubusercontent.com/roblabs/openmaptiles-ios-demo/master/OSM2VectorTiles/styles/geography-class.GitHub.json")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Similar as in my other comment, can we move the file here afterwards?


func makeUIView(context: UIViewRepresentableContext<MapView>) -> MGLMapView {
var frame = CGRect(x: 0, y: 0, width: 10, height: 20)
// frame = .zero // TODO: investigate if this case works
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we have the GitHub issue opened? We could reference it here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've opened issue #67. Which will make use of this new test app.

Copy link
Collaborator

@sulewicz sulewicz left a comment

Choose a reason for hiding this comment

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

Three minor comments.

@roblabs roblabs marked this pull request as draft April 17, 2021 02:36
Copy link
Contributor

@petr-pokorny-1 petr-pokorny-1 left a comment

Choose a reason for hiding this comment

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

Thanks @roblabs, looking good.

@roblabs roblabs added the metal label Apr 21, 2021
@roblabs roblabs marked this pull request as ready for review May 5, 2021 02:35
@roblabs roblabs merged commit 4bf4ed0 into maplibre:metal-support May 5, 2021
@roblabs roblabs added the iOS label Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants