-
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.
Merge pull request #33 from boostcamp3-iOS/develop
20190128
- Loading branch information
Showing
112 changed files
with
5,362 additions
and
354 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
disabled_rules: | ||
- leading_whitespace | ||
- trailing_whitespace | ||
- nesting | ||
|
||
excluded: | ||
FineDust/Supporting Files/AppDelegate.swift | ||
- FineDust/Supporting Files/AppDelegate.swift | ||
- FineDust/Supporting Files/GeoConverter.swift | ||
|
||
line_length: | ||
warning: 99 | ||
error: 120 | ||
warning: 99 | ||
error: 120 | ||
|
||
identifier_name: | ||
excluded: | ||
- x | ||
- y | ||
- dx |
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,62 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="IlJ-X8-Ugh"> | ||
<device id="retina4_7" orientation="portrait"> | ||
<adaptation id="fullscreen"/> | ||
</device> | ||
<dependencies> | ||
<deployment identifier="iOS"/> | ||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/> | ||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | ||
</dependencies> | ||
<scenes> | ||
<!--Main--> | ||
<scene sceneID="O9k-tV-aYt"> | ||
<objects> | ||
<viewControllerPlaceholder storyboardIdentifier="Main" storyboardName="Main" id="dfL-ab-jso" sceneMemberID="viewController"> | ||
<tabBarItem key="tabBarItem" title="Item" id="o6a-uJ-4rY"/> | ||
</viewControllerPlaceholder> | ||
<placeholder placeholderIdentifier="IBFirstResponder" id="IyA-va-e6X" userLabel="First Responder" sceneMemberID="firstResponder"/> | ||
</objects> | ||
<point key="canvasLocation" x="-536" y="-508"/> | ||
</scene> | ||
<!--Statistics--> | ||
<scene sceneID="4P2-Bc-Bb0"> | ||
<objects> | ||
<viewControllerPlaceholder storyboardIdentifier="Statistics" storyboardName="Statistics" id="jFQ-9p-ugh" sceneMemberID="viewController"> | ||
<tabBarItem key="tabBarItem" title="Item" id="ne2-If-hL7"/> | ||
</viewControllerPlaceholder> | ||
<placeholder placeholderIdentifier="IBFirstResponder" id="frB-eY-6SA" userLabel="First Responder" sceneMemberID="firstResponder"/> | ||
</objects> | ||
<point key="canvasLocation" x="-523" y="-387"/> | ||
</scene> | ||
<!--Tab Bar Controller--> | ||
<scene sceneID="5lI-42-cJZ"> | ||
<objects> | ||
<tabBarController id="IlJ-X8-Ugh" sceneMemberID="viewController"> | ||
<tabBar key="tabBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="9CY-Ak-aqb"> | ||
<rect key="frame" x="0.0" y="0.0" width="375" height="49"/> | ||
<autoresizingMask key="autoresizingMask"/> | ||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
</tabBar> | ||
<connections> | ||
<segue destination="dfL-ab-jso" kind="relationship" relationship="viewControllers" id="hdv-dR-dXQ"/> | ||
<segue destination="jFQ-9p-ugh" kind="relationship" relationship="viewControllers" id="ueU-nJ-ZPc"/> | ||
<segue destination="aX8-gk-I2E" kind="relationship" relationship="viewControllers" id="giY-KD-olX"/> | ||
</connections> | ||
</tabBarController> | ||
<placeholder placeholderIdentifier="IBFirstResponder" id="52U-o4-sG3" userLabel="First Responder" sceneMemberID="firstResponder"/> | ||
</objects> | ||
<point key="canvasLocation" x="-1159" y="-386"/> | ||
</scene> | ||
<!--Feedback--> | ||
<scene sceneID="6LB-xR-h5z"> | ||
<objects> | ||
<viewControllerPlaceholder storyboardIdentifier="Feedback" storyboardName="Feedback" id="aX8-gk-I2E" sceneMemberID="viewController"> | ||
<tabBarItem key="tabBarItem" title="Item" id="Kmx-8Q-yYD"/> | ||
</viewControllerPlaceholder> | ||
<placeholder placeholderIdentifier="IBFirstResponder" id="FBl-8w-zEJ" userLabel="First Responder" sceneMemberID="firstResponder"/> | ||
</objects> | ||
<point key="canvasLocation" x="-535" y="-283"/> | ||
</scene> | ||
</scenes> | ||
</document> |
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,83 @@ | ||
// | ||
// API+FineDust.swift | ||
// FineDust | ||
// | ||
// Created by Presto on 21/01/2019. | ||
// Copyright © 2019 boostcamp3rd. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
/// 미세먼지 API 관련 API 정의. | ||
extension API { | ||
/// 측정소 정보 조회. | ||
/// | ||
/// - Parameters: | ||
/// - pageNo: 페이지 인덱스. | ||
/// - numOfRows: 한 페이지에 노출되는 정보량. | ||
/// - completion: 컴플리션 핸들러. | ||
func fetchObservatory( | ||
pageNumber pageNo: Int = 1, | ||
numberOfRows numOfRows: Int = 10, | ||
completion: @escaping (ObservatoryResponse?, Error?) -> Void | ||
) { | ||
let urlString = baseURL | ||
.appending("/MsrstnInfoInqireSvc/getNearbyMsrstnList") | ||
.appending("?tmX=\(GeoInfo.shared.x)") | ||
.appending("&tmY=\(GeoInfo.shared.y)") | ||
.appending("&numOfRows=\(numOfRows)") | ||
.appending("&pageNo=\(pageNo)") | ||
.appending("&serviceKey=\(serviceKey)") | ||
.appending("&_returnType=json") | ||
guard let url = URL(string: urlString) else { return } | ||
Network.request(url, method: .get) { data, error in | ||
guard let data = data else { | ||
completion(nil, error) | ||
return | ||
} | ||
do { | ||
let response = try JSONDecoder().decode(ObservatoryResponse.self, from: data) | ||
completion(response, nil) | ||
} catch { | ||
completion(nil, error) | ||
} | ||
} | ||
} | ||
/// 미세먼지 농도 조회. | ||
/// | ||
/// - Parameters: | ||
/// - dataTerm: 데이터 기간. daily 또는 month. | ||
/// - pageNo: 페이지 인덱스. | ||
/// - numOfRows: 한 페이지에 노출되는 정보량. | ||
/// - completion: 컴플리션 핸들러. | ||
func fetchFineDustConcentration( | ||
term dataTerm: DataTerm, | ||
pageNumber pageNo: Int = 1, | ||
numberOfRows numOfRows: Int = 10, | ||
completion: @escaping (FineDustResponse?, Error?) -> Void | ||
) { | ||
let observatory = FineDustInfo.shared.observatory.percentEncoded | ||
let urlString = baseURL | ||
.appending("/ArpltnInforInqireSvc/getMsrstnAcctoRltmMesureDnsty") | ||
.appending("?stationName=\(observatory)") | ||
.appending("&dataTerm=\(dataTerm.rawValue)") | ||
.appending("&pageNo=\(pageNo)") | ||
.appending("&numOfRows=\(numOfRows)") | ||
.appending("&serviceKey=\(serviceKey)") | ||
.appending("&ver=1.1") | ||
.appending("&_returnType=json") | ||
guard let url = URL(string: urlString) else { return } | ||
Network.request(url, method: .get) { data, error in | ||
guard let data = data else { | ||
completion(nil, error) | ||
return | ||
} | ||
do { | ||
let response = try JSONDecoder().decode(FineDustResponse.self, from: data) | ||
completion(response, nil) | ||
} catch { | ||
completion(nil, error) | ||
} | ||
} | ||
} | ||
} |
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,31 @@ | ||
// | ||
// API.swift | ||
// FineDust | ||
// | ||
// Created by Presto on 21/01/2019. | ||
// Copyright © 2019 boostcamp3rd. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
/// API 정의. | ||
final class API { | ||
|
||
// MARK: Singleton Object | ||
|
||
/// API의 싱글톤 객체 | ||
static let shared = API() | ||
|
||
// MARK: Private Initializer | ||
|
||
private init() { } | ||
|
||
// MARK: Property | ||
|
||
/// Base URL. | ||
let baseURL = "http://openapi.airkorea.or.kr/openapi/services/rest" | ||
/// Service Key. | ||
let serviceKey = """ | ||
BfJjA4%2BuaBHhfAzyF2Ni6xoVDaf%2FhsZylifmFKdW3kyaZECH6c2Lua05fV%2F%2BYgbzPBaSl0YLZwI%2BW%2FK2xzO7sw%3D%3D | ||
""" | ||
} |
Oops, something went wrong.