Bonjour,

je veux reproduire ce fragment de code Kotlin en Swift mais je n'y arrive pas du tout.

Pourriez vous me donner un petit coup de pouce svp?

Cordialement,

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
 enum class Geolocalisation( val Latitude : Double, val Longitude : Double) {
    POINTA(48.97668904641622,3.285362720489502), 
    POINTB(48.97717494505196,3.287358283996582),
}
object FormuleGeo {
 
    fun distanceMetres() { println("Formules: Distance entre A et B : " +
            Math.acos(Math.sin(Math.toRadians(Geolocalisation.POINTA.Latitude)) *
            Math.sin(Math.toRadians(Geolocalisation.POINTB.Latitude)) +
            Math.cos(Math.toRadians(Geolocalisation.POINTA.Latitude)) *
            Math.cos(Math.toRadians(Geolocalisation.POINTB.Latitude)) *
            Math.cos(Math.toRadians(Geolocalisation.POINTA.Longitude - Geolocalisation.POINTB.Longitude)))
            * 6371 * 1000 + " mètres ")