Giter VIP home page Giter VIP logo

codelab-maps-platform-101-ios-swiftui's Introduction

codelab-maps-platform-101-ios-swiftui's People

Contributors

arriolac avatar

Stargazers

Binay Shaw avatar Aritra Das avatar JasonYang avatar micnncim avatar Artemiy avatar Michaela Hercogova avatar 사이먼 avatar Nick Fn Blum avatar  avatar Nikhil Tadikonda avatar Anthony Pulliam avatar  avatar

Watchers

Wayne Bishop avatar  avatar Marc avatar James Cloos avatar William French avatar Lyla Fujiwara avatar Cassandra Recher avatar  avatar Angela Yu avatar Stephen Gilson avatar dave avatar Aleks avatar Ari Oppenheimer avatar  avatar

codelab-maps-platform-101-ios-swiftui's Issues

I tried to install this - fails?

I tried multlple times to install this App. I left a message in the repository. You'll see (I think) I followed the instructions to the letter. I tried Pods etc. No Joy. I have other Apps using Google Maps - work flawlessly but here I'm missing the magic bit.

Wrong type description on the step 7 "Add markers to the map" on "Add a map to your iOS app with SwiftUI (Swift)" tutorial.

Issue description

In the example bellow CitiesList described as a class in the message before code snippet. Which is not correct.

Notice that ContentView uses the markers property to render the list of cities by passing it to the CitiesList class.

struct CitiesList: View {

  @Binding var markers: [GMSMarker]

  var body: some View {
    GeometryReader { geometry in
      VStack(spacing: 0) {
        // ...
        // List of Cities
        List {
          ForEach(0..<self.markers.count) { id in
            let marker = self.markers[id]
            Button(action: {
              buttonAction(marker)
            }) {
              Text(marker.title ?? "")
            }
          }
        }.frame(maxWidth: .infinity)
      }
    }
  }
}

Suggested solutions

  1. Substitute the word class with struct as shown bellow:

Notice that ContentView uses the markers property to render the list of cities by passing it to the CitiesList struct.

  1. Or just leave it as suggested in this example:

Notice that ContentView uses the markers property to render the list of cities by passing it to the CitiesList.

Additional Info

The issue can be observed on the link https://developers.google.com/codelabs/maps-platform/maps-platform-ios-swiftui#6

Unable to apply color style on map

I'm try to change the color of my swiftui code with below code but not working:

func makeUIView(context: Context) -> GMSMapView {
self.applyColorToMap()
return gmsMapView
}

func applyColorToMap() {
do {
// Set the map style by passing the URL of the local file.
if let styleURL = Bundle.main.url(forResource: "style", withExtension: "json") {
gmsMapView.mapStyle = try GMSMapStyle(contentsOfFileURL: styleURL)
} else {
NSLog("Unable to find style.json")
}
} catch {
NSLog("One or more of the map styles failed to load. (error)")
}

}

How to create custom marker?

Getting error while assigning MarkerView to the iconView

`import Foundation
import GoogleMaps

class PlaceMarker: GMSMarker {

init(position: CLLocationCoordinate2D, placeName: String) {
    super.init()
    self.position = position

    let markerView = MarkerView()

   iconView = markerView
}

}`

Screenshot 2022-12-22 at 11 28 43 AM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.