Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lecture/minsik/mentoring/MentoringWeatherAPI/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.xcconfig

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
A45696542A330A480062BD12 /* WeatherManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeatherManager.swift; sourceTree = "<group>"; };
A4AD65F82A4AD4390039746B /* WeatherData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeatherData.swift; sourceTree = "<group>"; };
A4AD65FA2A4C21C50039746B /* WeatherModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeatherModel.swift; sourceTree = "<group>"; };
A4BD8A7C2B04BCF70084308A /* Secrets.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Secrets.xcconfig; path = Model/Secrets.xcconfig; sourceTree = "<group>"; };
ADAA27AD231BBFAF00365194 /* Clima.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Clima.app; sourceTree = BUILT_PRODUCTS_DIR; };
ADAA27B0231BBFAF00365194 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
ADAA27B2231BBFAF00365194 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -79,6 +80,7 @@
ADAA27AF231BBFAF00365194 /* Clima */ = {
isa = PBXGroup;
children = (
A4BD8A7C2B04BCF70084308A /* Secrets.xcconfig */,
ADAA27B0231BBFAF00365194 /* AppDelegate.swift */,
ADAA27B2231BBFAF00365194 /* SceneDelegate.swift */,
A45696532A330A2E0062BD12 /* Model */,
Expand Down Expand Up @@ -330,6 +332,7 @@
};
ADAA27C2231BBFB300365194 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = A4BD8A7C2B04BCF70084308A /* Secrets.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
Expand Down
6 changes: 4 additions & 2 deletions lecture/minsik/mentoring/MentoringWeatherAPI/Clima/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string>We need your location to get the current weather for where you are.</string>
<key>API_KEY</key>
<string>$(API_KEY)</string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
Expand All @@ -22,6 +22,8 @@
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSLocationWhenInUseUsageDescription</key>
<string>We need your location to get the current weather for where you are.</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,20 @@
import Foundation
import CoreLocation



protocol WeatherManagerDelegate {
func didUpdateWeather(_ weatherManager: Weathermanager, weather: WeatherModel)
func didFailWithError(error: Error)
}

struct Weathermanager{
let weatherURL = "https://api.openweathermap.org/data/2.5/weather?appid=ecc3373ffe347304fd4ab1e4bbec05b7&units=metric"
struct Weathermanager {

private let apikey = Bundle.main.infoDictionary?["API_KEY"] as! String

var weatherURL: String {
return "https://api.openweathermap.org/data/2.5/weather?units=metric&appid=\(apikey)"
}

var delegate: WeatherManagerDelegate?

Expand Down