-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Feature/#2 recruit feed view
- Loading branch information
Showing
6 changed files
with
336 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
project02-teamB-OUR-consumer/project02-teamB-OUR-consumer/Extension.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// Extension.swift | ||
// project02-teamB-OUR-consumer | ||
// | ||
// Created by 윤해수 on 2023/08/22. | ||
// | ||
|
||
import SwiftUI | ||
|
||
//Color extension확장하여 Hex Color 받아서 바꾸기 | ||
extension Color { | ||
init(hex: String) { | ||
var hexSanitized = hex.trimmingCharacters(in: .whitespacesAndNewlines) | ||
hexSanitized = hexSanitized.replacingOccurrences(of: "#", with: "") | ||
|
||
var rgb: UInt64 = 0 | ||
|
||
Scanner(string: hexSanitized).scanHexInt64(&rgb) | ||
|
||
self.init( | ||
red: Double((rgb & 0xFF0000) >> 16) / 255.0, | ||
green: Double((rgb & 0x00FF00) >> 8) / 255.0, | ||
blue: Double(rgb & 0x0000FF) / 255.0 | ||
) | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
...ct02-teamB-OUR-consumer/project02-teamB-OUR-consumer/RecruitFeedView/RecruitFeedMap.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// | ||
// RecruitFeedMap.swift | ||
// project02-teamB-OUR-consumer | ||
// | ||
// Created by kaikim on 2023/08/22. | ||
// | ||
|
||
import SwiftUI | ||
import CoreLocation | ||
import CoreLocationUI | ||
|
||
class LocationManager: NSObject, ObservableObject { | ||
|
||
private let manager = CLLocationManager() | ||
@Published var userLocation: CLLocation? | ||
static let shared = LocationManager() | ||
var addressString = "" | ||
|
||
override init() { | ||
super.init() | ||
manager.delegate = self | ||
manager.desiredAccuracy = kCLLocationAccuracyBest | ||
manager.startUpdatingLocation() | ||
} | ||
|
||
func requestLocation() { | ||
manager.requestWhenInUseAuthorization() | ||
} | ||
|
||
} | ||
|
||
extension LocationManager: CLLocationManagerDelegate { | ||
func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) { | ||
|
||
switch status { | ||
|
||
case .notDetermined: | ||
print("DEBUG: Not Determined") | ||
case .restricted: | ||
print("DEBUG: Restricted") | ||
case .denied: | ||
print("DEBUG: Denied") | ||
case .authorizedAlways: | ||
print("DEBUG: Auth always") | ||
case .authorizedWhenInUse: | ||
print("DEBUG: AUTH when in use") | ||
@unknown default: | ||
break | ||
} | ||
} | ||
|
||
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { | ||
guard let location = locations.last else { return} | ||
self.userLocation = location | ||
|
||
} | ||
|
||
|
||
} |
Oops, something went wrong.