UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

proyect 14

Forums > 100 Days of SwiftUI

I am in proyect 14 and uo until this moment, i thougt that when you create a method in a class/Struct you should call it when you use it.

But in the mapkitView whe are creating methods an we are not calling them in any place, can some one tell me why this works?

3      

Are you talking about the methods inside struct MapView: UIViewRepresentable eg

func makeUIView(context: Context) -> MKMapView { }

func updateUIView(_ view: MKMapView, context: Context) { }

func makeCoordinator() -> Coordinator { }

These are called by the complier this is why they are required in the protocol of UIViewRepresentable so even if you do not call them directly when you put MapView() in your View you are call them via that.

3      

woooo, thank you!!!

That's the thing i miss about all the courses not this. I lost a lot of time with this little things. It will be cool if they explain how to read the documentation in real time while doing the apps.

I thougth it was call automatic but not why.

3      

Hacking with Swift is sponsored by RevenueCat

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.