Build a Maps Application in SwiftUI - Find Nearby Landmarks

Поделиться
HTML-код
  • Опубликовано: 18 сен 2024
  • In this video, Mohammad Azam will demonstrate how to build a maps application in SwiftUI which will display landmarks near the user's current location. Azam will also show how to use a single source of truth and update the views based on user's selection.
    GitHub: github.com/aza...
    #iosdev #swiftui #swiftuilocation #swiftuimaps
    If you liked this video and want to support my channel then check out my courses below:
    azamsharp.com/... Check out my courses at
    azamsharp.school/

Комментарии • 27

  • @bradkimbrell2707
    @bradkimbrell2707 2 года назад +1

    Great beginning of an app Mo! I added an xmark.circle.fill to the search field to clear it. Also used focusState to refocus on the search field after clearing and .removeAll() on the search array that populates the List. Also plan to add distance from my location to the points of interest. The search can find streets, any POI, and lots more. Thanks for the great MapKit structure!

  • @DrMemory99
    @DrMemory99 2 года назад +1

    Wow! Thank you so very very much! For me you covered a lot of ground in both technique and with SwiftUI/MapKit. Very clear and concise.! Thanks again; Worked great following along

  • @10dayboy
    @10dayboy 2 года назад

    This is the video I've been looking for. I cannot overstate the help this has provided. Thanks so much!

  • @santhoshVnair
    @santhoshVnair Год назад +1

    As usual, excellent always. This code as is with Xcode 14.2, I am getting this warning: "Publishing changes from within view updates is not allowed, this will cause undefined behavior.". I know this showed up as a new warning, and Rebeloper published a work around. I think, it will be nice to hear a proper fix than a workaround.

  • @akiakic
    @akiakic 2 года назад +1

    Great as always. How would you implement map overlay? UIViewRepresentable? Maybe idea for next video.

  • @spradohak
    @spradohak 2 года назад

    Great video, I learned a lot of stuff.
    Thank you so much Mohamed

  • @DrMemory99
    @DrMemory99 2 года назад +1

    Thanks!

  • @vitoroteroo
    @vitoroteroo Год назад

    Hi, nice video, can you just explain a solution for the warning "Publishing changes from within view updates is not allowed, this will cause undefined behavior." thanks

  • @ShawnKirlin
    @ShawnKirlin Год назад

    Outstanding video sir! Can you share the code to unwrap the CLLocationCoordinate2D in Landmark to provide a Double to share in an array stored in Firebase? Thanks so much for sharing this outstanding video!!

  • @LisaSmith-oh5nb
    @LisaSmith-oh5nb Год назад

    Thank you so much for this video! Been looking for this map help!
    btw, would you have any instructions on how to add firebase code to the map? Outside of the regular setup with Firebase and SDK to iOS, how would one allow the map data to flow to firebase?
    e.g.
    func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
    guard let location = locations.last else { return }
    let fireDatabase = Firestore.firestore()
    DispatchQueue.main.async { [weak self] in
    self?.region = MKCoordinateRegion(center: location.coordinate, span: MKCoordinateSpan(latitudeDelta: 0.25, longitudeDelta: 0.25))
    }
    }
    How could one include "let fireDatabase" into LocationManager?
    Apologies for asking specifics...

  • @ThePhotodiver
    @ThePhotodiver Год назад

    Instead of using a Textfield to search for a specific Landmark, what would you put in the search query to automatically search for all landmarks in the current location?

  • @alenayoutube1574
    @alenayoutube1574 Год назад

    sir how are you researching and learning these all

  • @fsdolphin
    @fsdolphin 2 года назад

    Very good tutorial. What part do I need to change to be able to search the user's current location instead of Cupertino CA? I tried it on the device and it keeps searching Cupertino. You can of course be more specific on the search by including the name of the city you're in but is there a way to automatically searches in the user's current location?

    • @azamsharp
      @azamsharp  2 года назад

      You will have to use LocationManager to get the location. Try to run it on real device and I think it will show correct location.

    • @fsdolphin
      @fsdolphin 2 года назад

      ​@@azamsharp Never mind, I didn't have one of the Privacy - keys spelled correctly so it wasn't asking for permission. It's now working great. Thanks a lot for the good tutorial.

  • @apurvsingh5541
    @apurvsingh5541 Год назад

    I had downloaded the repo. I am getting several warnings. Could you please check if it is happening with you as well?
    Publishing changes from within view updates is not allowed, this will cause undefined behavior.

    • @azamsharp
      @azamsharp  Год назад

      Yeah. I was never able to solve that issue.

  • @alenayoutube1574
    @alenayoutube1574 Год назад

    i m a complete beginner but i know java , i tried swift ui it ok but how can be more skilled in implementing new things by researching can you make a video on it how you are researching and learning new things.

    • @azamsharp
      @azamsharp  Год назад

      azamsharp.com/2022/11/06/complete-guide-ios-dev-2023.html

  • @joshuajaydan
    @joshuajaydan Год назад

    I am getting thousands of purple warnings 'Publishing changes from within view updates is not allowed, this will cause undefined behavior.' so much that Xcode is lagging or freezing. Any idea how I can fix that?

    • @azamsharp
      @azamsharp  Год назад

      I was never able to solve those warnings.

    • @omursenocak2267
      @omursenocak2267 Год назад

      @@azamsharp I'd be grateful if you share here with us, to find a way to get rid of those thousands of purple warnings.

    • @azamsharp
      @azamsharp  Год назад

      @@omursenocak2267 I was never able to figure out the reason for the warnings.

  • @dani2kn
    @dani2kn Год назад

    Hello, I'm getting this error:
    Thread 1: Fatal error: No ObservableObject of type LocalSearchService found. A View.environmentObject(_:) for LocalSearchService may be missing as an ancestor of this view.
    in ContentView
    Can you help? Thanks!

    • @LisaSmith-oh5nb
      @LisaSmith-oh5nb Год назад

      in the Preview section add. ContentView().environmentObject(LocalSearchService())
      e.g.
      struct ContentView_Previews: PreviewProvider {
      static var previews: some View {
      ContentView().environmentObject(LocalSearchService())
      }
      }

  • @MAHOSSAN1
    @MAHOSSAN1 6 месяцев назад

    Thanks for tutoring . But there One error needs to resolve .. Publishing changes from within view updates is not allowed, this will cause undefined behavior.. Into LocalSearchService . even wrapping with @MainActor does not solve the warning