250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- effect
- 비전공자
- front-end
- MAC
- 비전공 개발자
- keyframes
- 백엔드
- hover
- button
- html5
- image
- ipad
- iOS 개발자
- 개발자
- javascript
- 자바스크립트
- react
- IOS
- css3
- Animation
- xcode
- 풀스택
- php
- jQuery
- 프론트엔드
- CSS
- SWIFT
- iPhone
- 애니메이션
- HTML
Archives
- Today
- Total
비전공자 개발일기
Distance Calculator 본문
728x90
SMALL
import UIKit
import CoreLocation
func distanceCalculator(preLat: Double?, preLng: Double?, postLat: Double?, postLng: Double?) -> String {
guard let preLat = preLat, let preLng = preLng, let postLat = postLat, let postLng = postLng else {
return ""
}
let preLocation = CLLocation(latitude: preLat, longitude: preLng)
let postLocation = CLLocation(latitude: postLat, longitude: postLng)
let distanceInMeters = preLocation.distance(from: postLocation)
return String(distanceInMeters.rounded(.toNearestOrAwayFromZero))
}
let res = distanceCalculator(preLat: +37.33124551, preLng: -122.03073664, postLat: +37.33121136, postLng: -122.03073097)
print("RESULT is \(res)m")
728x90
LIST
'SWIFT' 카테고리의 다른 글
iOS 개발자가 되기 위해서 (0) | 2023.04.30 |
---|---|
After Last Xcode Update (14.3 14E222b) I am no longer able to archive my app (0) | 2023.04.25 |
Xcode Simulator Cache Delete (0) | 2023.04.21 |
Virate Method (0) | 2023.04.14 |
WKWebView OverScroll Disable Setting (0) | 2023.03.15 |