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
434 changes: 434 additions & 0 deletions week4_minchae/WeatherApp/WeatherApp.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-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>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1520"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B1F844492BF130B600823C86"
BuildableName = "WeatherApp.app"
BlueprintName = "WeatherApp"
ReferencedContainer = "container:WeatherApp.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B1F844492BF130B600823C86"
BuildableName = "WeatherApp.app"
BlueprintName = "WeatherApp"
ReferencedContainer = "container:WeatherApp.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B1F844492BF130B600823C86"
BuildableName = "WeatherApp.app"
BlueprintName = "WeatherApp"
ReferencedContainer = "container:WeatherApp.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// SettingsViewController.swift
// WeatherApp
//
// Created by 황민채 on 5/13/24.
//

import UIKit

class SettingsViewController: UIViewController {

private let primaryView = SettingsView()

override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .systemBackground

view.addSubview(primaryView)
NSLayoutConstraint.activate([
primaryView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
primaryView.leftAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leftAnchor),
primaryView.rightAnchor.constraint(equalTo: view.safeAreaLayoutGuide.rightAnchor),
primaryView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor)
])
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// TabViewController.swift
// WeatherApp
//
// Created by 황민채 on 5/13/24.
//

import UIKit

final class TabViewController: UITabBarController {

override func viewDidLoad() {
super.viewDidLoad()

let tab1 = WeatherViewController()
tab1.title = "Weather"

let tab2 = SettingsViewController()
tab2.title = "Setting"

let nav1 = UINavigationController(rootViewController: tab1)
let nav2 = UINavigationController(rootViewController: tab2)

nav1.tabBarItem = UITabBarItem(title: "Weather", image: UIImage(named: "cloud.sun"), tag: 1)
nav2.tabBarItem = UITabBarItem(title: "Settings", image: UIImage(named: "gear"), tag: 2)

setViewControllers([
nav1, nav2
], animated: true)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// WeatherViewController.swift
// WeatherApp
//
// Created by 황민채 on 5/13/24.
//

import UIKit

class WeatherViewController: UIViewController {

private let primaryView = CurrentWeatherView()

override func viewDidLoad() {
super.viewDidLoad()
setUpView()
getLocation()
}
private func getLocation() {
LocationManager.shared.getCurrentLocation { location in
print(String(describing: location))

WeatherManager.shared.getWeather(for: location)
}
}

private func setUpView() {
view.backgroundColor = .systemBackground

view.addSubview(primaryView)
NSLayoutConstraint.activate([
primaryView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
primaryView.leftAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leftAnchor),
primaryView.rightAnchor.constraint(equalTo: view.safeAreaLayoutGuide.rightAnchor),
primaryView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor)
])
}
}

25 changes: 25 additions & 0 deletions week4_minchae/WeatherApp/WeatherApp/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-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>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
</dict>
</array>
</dict>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Please allow location access to see your local weather data</string>
</dict>
</plist>
15 changes: 15 additions & 0 deletions week4_minchae/WeatherApp/WeatherApp/Managers/IAPManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// IAPManager.swift
// WeatherApp
//
// Created by 황민채 on 5/13/24.
//

// TODO: Bring in RevenueCat
import Foundation

final class IAPManager {
static let shared = IAPManager()

private init() { }
}
21 changes: 21 additions & 0 deletions week4_minchae/WeatherApp/WeatherApp/Managers/WeatherManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// WeatherManager.swift
// WeatherApp
//
// Created by 황민채 on 5/13/24.
//

import CoreLocation
import WeatherKit
import Foundation


final class WeatherManager {
static let shared = WeatherManager()

private init() { }

public func getWeather(for location: CLLocation) {

}
}
43 changes: 43 additions & 0 deletions week4_minchae/WeatherApp/WeatherApp/Managers/locationManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// locationManager.swift
// WeatherApp
//
// Created by 황민채 on 5/13/24.
//

import CoreLocation
import Foundation

final class LocationManager: NSObject, CLLocationManagerDelegate {

private let manager = CLLocationManager()

static let shared = LocationManager()

private var locationFetchCompletion: ((CLLocation) -> Void)?

private var location: CLLocation? {
didSet {
guard let location else {
return
}
locationFetchCompletion?(location)
}
}

public func getCurrentLocation(completion: @escaping (CLLocation) -> Void) {
self.locationFetchCompletion = completion

manager.requestWhenInUseAuthorization()
manager.delegate = self
manager.startUpdatingLocation()
}

func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
guard let location = locations.first else {
return
}
self.location = location
manager.stopUpdatingLocation()
}
}
36 changes: 36 additions & 0 deletions week4_minchae/WeatherApp/WeatherApp/Other/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// AppDelegate.swift
// WeatherApp
//
// Created by 황민채 on 5/13/24.
//

import UIKit

@main
class AppDelegate: UIResponder, UIApplicationDelegate {



func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}

// MARK: UISceneSession Lifecycle

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}


}

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
Loading