├── SwiftWeather
├── Assets.xcassets
│ ├── Contents.json
│ ├── fog.imageset
│ │ ├── fog.png
│ │ └── Contents.json
│ ├── rain.imageset
│ │ ├── rain.png
│ │ └── Contents.json
│ ├── snow.imageset
│ │ ├── snow.png
│ │ └── Contents.json
│ ├── wind.imageset
│ │ ├── wind.png
│ │ └── Contents.json
│ ├── cloudy.imageset
│ │ ├── cloudy.png
│ │ └── Contents.json
│ ├── sleet.imageset
│ │ ├── sleet.png
│ │ └── Contents.json
│ ├── clear-day.imageset
│ │ ├── clear-day.png
│ │ └── Contents.json
│ ├── clear-night.imageset
│ │ ├── clear-night.png
│ │ └── Contents.json
│ ├── partly-cloudy-day.imageset
│ │ ├── partly-cloudy-day.png
│ │ └── Contents.json
│ ├── partly-cloudy-night.imageset
│ │ ├── partly-cloudy-night.png
│ │ └── Contents.json
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── Info.plist
├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
├── AppDelegate.swift
├── Weather.swift
└── WeatherTableViewController.swift
├── SwiftWeather.xcodeproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
├── xcuserdata
│ └── brianadvent.xcuserdatad
│ │ └── xcschemes
│ │ ├── xcschememanagement.plist
│ │ └── SwiftWeather.xcscheme
└── project.pbxproj
└── README.md
/SwiftWeather/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/SwiftWeather/Assets.xcassets/fog.imageset/fog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianadvent/WeatherApp/HEAD/SwiftWeather/Assets.xcassets/fog.imageset/fog.png
--------------------------------------------------------------------------------
/SwiftWeather/Assets.xcassets/rain.imageset/rain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianadvent/WeatherApp/HEAD/SwiftWeather/Assets.xcassets/rain.imageset/rain.png
--------------------------------------------------------------------------------
/SwiftWeather/Assets.xcassets/snow.imageset/snow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianadvent/WeatherApp/HEAD/SwiftWeather/Assets.xcassets/snow.imageset/snow.png
--------------------------------------------------------------------------------
/SwiftWeather/Assets.xcassets/wind.imageset/wind.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianadvent/WeatherApp/HEAD/SwiftWeather/Assets.xcassets/wind.imageset/wind.png
--------------------------------------------------------------------------------
/SwiftWeather/Assets.xcassets/cloudy.imageset/cloudy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianadvent/WeatherApp/HEAD/SwiftWeather/Assets.xcassets/cloudy.imageset/cloudy.png
--------------------------------------------------------------------------------
/SwiftWeather/Assets.xcassets/sleet.imageset/sleet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianadvent/WeatherApp/HEAD/SwiftWeather/Assets.xcassets/sleet.imageset/sleet.png
--------------------------------------------------------------------------------
/SwiftWeather/Assets.xcassets/clear-day.imageset/clear-day.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianadvent/WeatherApp/HEAD/SwiftWeather/Assets.xcassets/clear-day.imageset/clear-day.png
--------------------------------------------------------------------------------
/SwiftWeather/Assets.xcassets/clear-night.imageset/clear-night.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianadvent/WeatherApp/HEAD/SwiftWeather/Assets.xcassets/clear-night.imageset/clear-night.png
--------------------------------------------------------------------------------
/SwiftWeather/Assets.xcassets/partly-cloudy-day.imageset/partly-cloudy-day.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianadvent/WeatherApp/HEAD/SwiftWeather/Assets.xcassets/partly-cloudy-day.imageset/partly-cloudy-day.png
--------------------------------------------------------------------------------
/SwiftWeather/Assets.xcassets/partly-cloudy-night.imageset/partly-cloudy-night.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianadvent/WeatherApp/HEAD/SwiftWeather/Assets.xcassets/partly-cloudy-night.imageset/partly-cloudy-night.png
--------------------------------------------------------------------------------
/SwiftWeather.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/SwiftWeather/Assets.xcassets/fog.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "fog.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/SwiftWeather/Assets.xcassets/rain.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "rain.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/SwiftWeather/Assets.xcassets/snow.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "snow.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/SwiftWeather/Assets.xcassets/wind.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "wind.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/SwiftWeather/Assets.xcassets/cloudy.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "cloudy.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/SwiftWeather/Assets.xcassets/sleet.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "sleet.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/SwiftWeather/Assets.xcassets/clear-day.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "clear-day.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/SwiftWeather/Assets.xcassets/clear-night.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "clear-night.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/SwiftWeather/Assets.xcassets/partly-cloudy-day.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "partly-cloudy-day.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/SwiftWeather/Assets.xcassets/partly-cloudy-night.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "partly-cloudy-night.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # iOS Swift Tutorial: Create a Weather App from Scratch
2 |
3 | Learn how to populate a user interface with data from the web. In that process we are creating a simple UI featuring a TableViewController and using JSON data we get from the darksky API.
4 |
5 | ➡️ [Video on YouTube](https://youtu.be/doqtsIsbtqs)
6 | ➡️ [Tutorial on how to download data from a web API and process JSON data:](https://youtu.be/_c0pAz3UPEs)
7 |
8 | https://youtu.be/_c0pAz3UPEs
9 |
10 | [](https://www.youtube.com/watch?v=doqtsIsbtqs)
11 |
--------------------------------------------------------------------------------
/SwiftWeather.xcodeproj/xcuserdata/brianadvent.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | SwiftWeather.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 52AA6F681EC7345F003A477C
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/SwiftWeather/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "60x60",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "size" : "60x60",
41 | "scale" : "3x"
42 | }
43 | ],
44 | "info" : {
45 | "version" : 1,
46 | "author" : "xcode"
47 | }
48 | }
--------------------------------------------------------------------------------
/SwiftWeather/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/SwiftWeather/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/SwiftWeather/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // SwiftWeather
4 | //
5 | // Created by Brian Advent on 13.05.17.
6 | // Copyright © 2017 Brian Advent. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 |
17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
18 | // Override point for customization after application launch.
19 | return true
20 | }
21 |
22 | func applicationWillResignActive(_ application: UIApplication) {
23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
25 | }
26 |
27 | func applicationDidEnterBackground(_ application: UIApplication) {
28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30 | }
31 |
32 | func applicationWillEnterForeground(_ application: UIApplication) {
33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
34 | }
35 |
36 | func applicationDidBecomeActive(_ application: UIApplication) {
37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
38 | }
39 |
40 | func applicationWillTerminate(_ application: UIApplication) {
41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42 | }
43 |
44 |
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/SwiftWeather/Weather.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Weather.swift
3 | // JSON
4 | //
5 | // Created by Brian Advent on 11.05.17.
6 | // Copyright © 2017 Brian Advent. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import CoreLocation
11 |
12 | struct Weather {
13 | let summary:String
14 | let icon:String
15 | let temperature:Double
16 |
17 | enum SerializationError:Error {
18 | case missing(String)
19 | case invalid(String, Any)
20 | }
21 |
22 |
23 | init(json:[String:Any]) throws {
24 | guard let summary = json["summary"] as? String else {throw SerializationError.missing("summary is missing")}
25 |
26 | guard let icon = json["icon"] as? String else {throw SerializationError.missing("icon is missing")}
27 |
28 | guard let temperature = json["temperatureMax"] as? Double else {throw SerializationError.missing("temp is missing")}
29 |
30 | self.summary = summary
31 | self.icon = icon
32 | self.temperature = temperature
33 |
34 | }
35 |
36 |
37 | static let basePath = "https://api.darksky.net/forecast/YOUR_APIKEY/"
38 |
39 | static func forecast (withLocation location:CLLocationCoordinate2D, completion: @escaping ([Weather]?) -> ()) {
40 |
41 | let url = basePath + "\(location.latitude),\(location.longitude)"
42 | let request = URLRequest(url: URL(string: url)!)
43 |
44 | let task = URLSession.shared.dataTask(with: request) { (data:Data?, response:URLResponse?, error:Error?) in
45 |
46 | var forecastArray:[Weather] = []
47 |
48 | if let data = data {
49 |
50 | do {
51 | if let json = try JSONSerialization.jsonObject(with: data, options: []) as? [String:Any] {
52 | if let dailyForecasts = json["daily"] as? [String:Any] {
53 | if let dailyData = dailyForecasts["data"] as? [[String:Any]] {
54 | for dataPoint in dailyData {
55 | if let weatherObject = try? Weather(json: dataPoint) {
56 | forecastArray.append(weatherObject)
57 | }
58 | }
59 | }
60 | }
61 |
62 | }
63 | }catch {
64 | print(error.localizedDescription)
65 | }
66 |
67 | completion(forecastArray)
68 |
69 | }
70 |
71 |
72 | }
73 |
74 | task.resume()
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 | }
85 |
86 |
87 | }
88 |
--------------------------------------------------------------------------------
/SwiftWeather.xcodeproj/xcuserdata/brianadvent.xcuserdatad/xcschemes/SwiftWeather.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/SwiftWeather/WeatherTableViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // WeatherTableViewController.swift
3 | // SwiftWeather
4 | //
5 | // Created by Brian Advent on 13.05.17.
6 | // Copyright © 2017 Brian Advent. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import CoreLocation
11 |
12 | class WeatherTableViewController: UITableViewController, UISearchBarDelegate {
13 |
14 | @IBOutlet weak var searchBar: UISearchBar!
15 |
16 | var forecastData = [Weather]()
17 |
18 | override func viewDidLoad() {
19 | super.viewDidLoad()
20 |
21 | searchBar.delegate = self
22 |
23 | updateWeatherForLocation(location: "New York")
24 | }
25 |
26 |
27 | func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
28 | searchBar.resignFirstResponder()
29 | if let locationString = searchBar.text, !locationString.isEmpty {
30 | updateWeatherForLocation(location: locationString)
31 | }
32 |
33 | }
34 |
35 | func updateWeatherForLocation (location:String) {
36 | CLGeocoder().geocodeAddressString(location) { (placemarks:[CLPlacemark]?, error:Error?) in
37 | if error == nil {
38 | if let location = placemarks?.first?.location {
39 | Weather.forecast(withLocation: location.coordinate, completion: { (results:[Weather]?) in
40 |
41 | if let weatherData = results {
42 | self.forecastData = weatherData
43 |
44 | DispatchQueue.main.async {
45 | self.tableView.reloadData()
46 | }
47 |
48 | }
49 |
50 | })
51 | }
52 | }
53 | }
54 | }
55 |
56 |
57 | override func didReceiveMemoryWarning() {
58 | super.didReceiveMemoryWarning()
59 | // Dispose of any resources that can be recreated.
60 | }
61 |
62 | // MARK: - Table view data source
63 |
64 | override func numberOfSections(in tableView: UITableView) -> Int {
65 | // #warning Incomplete implementation, return the number of sections
66 | return forecastData.count
67 | }
68 |
69 | override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
70 | // #warning Incomplete implementation, return the number of rows
71 | return 1
72 | }
73 |
74 | override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
75 | let date = Calendar.current.date(byAdding: .day, value: section, to: Date())
76 | let dateFormatter = DateFormatter()
77 | dateFormatter.dateFormat = "MMMM dd, yyyy"
78 |
79 | return dateFormatter.string(from: date!)
80 | }
81 |
82 |
83 | override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
84 | let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
85 |
86 | let weatherObject = forecastData[indexPath.section]
87 |
88 | cell.textLabel?.text = weatherObject.summary
89 | cell.detailTextLabel?.text = "\(Int(weatherObject.temperature)) °F"
90 | cell.imageView?.image = UIImage(named: weatherObject.icon)
91 |
92 | return cell
93 | }
94 |
95 |
96 | /*
97 | // Override to support conditional editing of the table view.
98 | override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
99 | // Return false if you do not want the specified item to be editable.
100 | return true
101 | }
102 | */
103 |
104 | /*
105 | // Override to support editing the table view.
106 | override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
107 | if editingStyle == .delete {
108 | // Delete the row from the data source
109 | tableView.deleteRows(at: [indexPath], with: .fade)
110 | } else if editingStyle == .insert {
111 | // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
112 | }
113 | }
114 | */
115 |
116 | /*
117 | // Override to support rearranging the table view.
118 | override func tableView(_ tableView: UITableView, moveRowAt fromIndexPath: IndexPath, to: IndexPath) {
119 |
120 | }
121 | */
122 |
123 | /*
124 | // Override to support conditional rearranging of the table view.
125 | override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool {
126 | // Return false if you do not want the item to be re-orderable.
127 | return true
128 | }
129 | */
130 |
131 | /*
132 | // MARK: - Navigation
133 |
134 | // In a storyboard-based application, you will often want to do a little preparation before navigation
135 | override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
136 | // Get the new view controller using segue.destinationViewController.
137 | // Pass the selected object to the new view controller.
138 | }
139 | */
140 |
141 | }
142 |
--------------------------------------------------------------------------------
/SwiftWeather/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
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 |
32 |
33 |
40 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/SwiftWeather.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 52AA6F6D1EC7345F003A477C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52AA6F6C1EC7345F003A477C /* AppDelegate.swift */; };
11 | 52AA6F721EC7345F003A477C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 52AA6F701EC7345F003A477C /* Main.storyboard */; };
12 | 52AA6F741EC7345F003A477C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 52AA6F731EC7345F003A477C /* Assets.xcassets */; };
13 | 52AA6F771EC7345F003A477C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 52AA6F751EC7345F003A477C /* LaunchScreen.storyboard */; };
14 | 52AA6F7F1EC73576003A477C /* WeatherTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52AA6F7E1EC73576003A477C /* WeatherTableViewController.swift */; };
15 | 52AA6F811EC735CB003A477C /* Weather.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52AA6F801EC735CB003A477C /* Weather.swift */; };
16 | /* End PBXBuildFile section */
17 |
18 | /* Begin PBXFileReference section */
19 | 52AA6F691EC7345F003A477C /* SwiftWeather.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftWeather.app; sourceTree = BUILT_PRODUCTS_DIR; };
20 | 52AA6F6C1EC7345F003A477C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
21 | 52AA6F711EC7345F003A477C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
22 | 52AA6F731EC7345F003A477C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
23 | 52AA6F761EC7345F003A477C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
24 | 52AA6F781EC7345F003A477C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
25 | 52AA6F7E1EC73576003A477C /* WeatherTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WeatherTableViewController.swift; sourceTree = ""; };
26 | 52AA6F801EC735CB003A477C /* Weather.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Weather.swift; sourceTree = ""; };
27 | /* End PBXFileReference section */
28 |
29 | /* Begin PBXFrameworksBuildPhase section */
30 | 52AA6F661EC7345F003A477C /* Frameworks */ = {
31 | isa = PBXFrameworksBuildPhase;
32 | buildActionMask = 2147483647;
33 | files = (
34 | );
35 | runOnlyForDeploymentPostprocessing = 0;
36 | };
37 | /* End PBXFrameworksBuildPhase section */
38 |
39 | /* Begin PBXGroup section */
40 | 52AA6F601EC7345F003A477C = {
41 | isa = PBXGroup;
42 | children = (
43 | 52AA6F6B1EC7345F003A477C /* SwiftWeather */,
44 | 52AA6F6A1EC7345F003A477C /* Products */,
45 | );
46 | sourceTree = "";
47 | };
48 | 52AA6F6A1EC7345F003A477C /* Products */ = {
49 | isa = PBXGroup;
50 | children = (
51 | 52AA6F691EC7345F003A477C /* SwiftWeather.app */,
52 | );
53 | name = Products;
54 | sourceTree = "";
55 | };
56 | 52AA6F6B1EC7345F003A477C /* SwiftWeather */ = {
57 | isa = PBXGroup;
58 | children = (
59 | 52AA6F6C1EC7345F003A477C /* AppDelegate.swift */,
60 | 52AA6F801EC735CB003A477C /* Weather.swift */,
61 | 52AA6F7E1EC73576003A477C /* WeatherTableViewController.swift */,
62 | 52AA6F701EC7345F003A477C /* Main.storyboard */,
63 | 52AA6F731EC7345F003A477C /* Assets.xcassets */,
64 | 52AA6F751EC7345F003A477C /* LaunchScreen.storyboard */,
65 | 52AA6F781EC7345F003A477C /* Info.plist */,
66 | );
67 | path = SwiftWeather;
68 | sourceTree = "";
69 | };
70 | /* End PBXGroup section */
71 |
72 | /* Begin PBXNativeTarget section */
73 | 52AA6F681EC7345F003A477C /* SwiftWeather */ = {
74 | isa = PBXNativeTarget;
75 | buildConfigurationList = 52AA6F7B1EC7345F003A477C /* Build configuration list for PBXNativeTarget "SwiftWeather" */;
76 | buildPhases = (
77 | 52AA6F651EC7345F003A477C /* Sources */,
78 | 52AA6F661EC7345F003A477C /* Frameworks */,
79 | 52AA6F671EC7345F003A477C /* Resources */,
80 | );
81 | buildRules = (
82 | );
83 | dependencies = (
84 | );
85 | name = SwiftWeather;
86 | productName = SwiftWeather;
87 | productReference = 52AA6F691EC7345F003A477C /* SwiftWeather.app */;
88 | productType = "com.apple.product-type.application";
89 | };
90 | /* End PBXNativeTarget section */
91 |
92 | /* Begin PBXProject section */
93 | 52AA6F611EC7345F003A477C /* Project object */ = {
94 | isa = PBXProject;
95 | attributes = {
96 | LastSwiftUpdateCheck = 0830;
97 | LastUpgradeCheck = 0830;
98 | ORGANIZATIONNAME = "Brian Advent";
99 | TargetAttributes = {
100 | 52AA6F681EC7345F003A477C = {
101 | CreatedOnToolsVersion = 8.3;
102 | ProvisioningStyle = Automatic;
103 | };
104 | };
105 | };
106 | buildConfigurationList = 52AA6F641EC7345F003A477C /* Build configuration list for PBXProject "SwiftWeather" */;
107 | compatibilityVersion = "Xcode 3.2";
108 | developmentRegion = English;
109 | hasScannedForEncodings = 0;
110 | knownRegions = (
111 | en,
112 | Base,
113 | );
114 | mainGroup = 52AA6F601EC7345F003A477C;
115 | productRefGroup = 52AA6F6A1EC7345F003A477C /* Products */;
116 | projectDirPath = "";
117 | projectRoot = "";
118 | targets = (
119 | 52AA6F681EC7345F003A477C /* SwiftWeather */,
120 | );
121 | };
122 | /* End PBXProject section */
123 |
124 | /* Begin PBXResourcesBuildPhase section */
125 | 52AA6F671EC7345F003A477C /* Resources */ = {
126 | isa = PBXResourcesBuildPhase;
127 | buildActionMask = 2147483647;
128 | files = (
129 | 52AA6F771EC7345F003A477C /* LaunchScreen.storyboard in Resources */,
130 | 52AA6F741EC7345F003A477C /* Assets.xcassets in Resources */,
131 | 52AA6F721EC7345F003A477C /* Main.storyboard in Resources */,
132 | );
133 | runOnlyForDeploymentPostprocessing = 0;
134 | };
135 | /* End PBXResourcesBuildPhase section */
136 |
137 | /* Begin PBXSourcesBuildPhase section */
138 | 52AA6F651EC7345F003A477C /* Sources */ = {
139 | isa = PBXSourcesBuildPhase;
140 | buildActionMask = 2147483647;
141 | files = (
142 | 52AA6F7F1EC73576003A477C /* WeatherTableViewController.swift in Sources */,
143 | 52AA6F811EC735CB003A477C /* Weather.swift in Sources */,
144 | 52AA6F6D1EC7345F003A477C /* AppDelegate.swift in Sources */,
145 | );
146 | runOnlyForDeploymentPostprocessing = 0;
147 | };
148 | /* End PBXSourcesBuildPhase section */
149 |
150 | /* Begin PBXVariantGroup section */
151 | 52AA6F701EC7345F003A477C /* Main.storyboard */ = {
152 | isa = PBXVariantGroup;
153 | children = (
154 | 52AA6F711EC7345F003A477C /* Base */,
155 | );
156 | name = Main.storyboard;
157 | sourceTree = "";
158 | };
159 | 52AA6F751EC7345F003A477C /* LaunchScreen.storyboard */ = {
160 | isa = PBXVariantGroup;
161 | children = (
162 | 52AA6F761EC7345F003A477C /* Base */,
163 | );
164 | name = LaunchScreen.storyboard;
165 | sourceTree = "";
166 | };
167 | /* End PBXVariantGroup section */
168 |
169 | /* Begin XCBuildConfiguration section */
170 | 52AA6F791EC7345F003A477C /* Debug */ = {
171 | isa = XCBuildConfiguration;
172 | buildSettings = {
173 | ALWAYS_SEARCH_USER_PATHS = NO;
174 | CLANG_ANALYZER_NONNULL = YES;
175 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
176 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
177 | CLANG_CXX_LIBRARY = "libc++";
178 | CLANG_ENABLE_MODULES = YES;
179 | CLANG_ENABLE_OBJC_ARC = YES;
180 | CLANG_WARN_BOOL_CONVERSION = YES;
181 | CLANG_WARN_CONSTANT_CONVERSION = YES;
182 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
183 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
184 | CLANG_WARN_EMPTY_BODY = YES;
185 | CLANG_WARN_ENUM_CONVERSION = YES;
186 | CLANG_WARN_INFINITE_RECURSION = YES;
187 | CLANG_WARN_INT_CONVERSION = YES;
188 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
189 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
190 | CLANG_WARN_UNREACHABLE_CODE = YES;
191 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
192 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
193 | COPY_PHASE_STRIP = NO;
194 | DEBUG_INFORMATION_FORMAT = dwarf;
195 | ENABLE_STRICT_OBJC_MSGSEND = YES;
196 | ENABLE_TESTABILITY = YES;
197 | GCC_C_LANGUAGE_STANDARD = gnu99;
198 | GCC_DYNAMIC_NO_PIC = NO;
199 | GCC_NO_COMMON_BLOCKS = YES;
200 | GCC_OPTIMIZATION_LEVEL = 0;
201 | GCC_PREPROCESSOR_DEFINITIONS = (
202 | "DEBUG=1",
203 | "$(inherited)",
204 | );
205 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
206 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
207 | GCC_WARN_UNDECLARED_SELECTOR = YES;
208 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
209 | GCC_WARN_UNUSED_FUNCTION = YES;
210 | GCC_WARN_UNUSED_VARIABLE = YES;
211 | IPHONEOS_DEPLOYMENT_TARGET = 10.3;
212 | MTL_ENABLE_DEBUG_INFO = YES;
213 | ONLY_ACTIVE_ARCH = YES;
214 | SDKROOT = iphoneos;
215 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
216 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
217 | };
218 | name = Debug;
219 | };
220 | 52AA6F7A1EC7345F003A477C /* Release */ = {
221 | isa = XCBuildConfiguration;
222 | buildSettings = {
223 | ALWAYS_SEARCH_USER_PATHS = NO;
224 | CLANG_ANALYZER_NONNULL = YES;
225 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
226 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
227 | CLANG_CXX_LIBRARY = "libc++";
228 | CLANG_ENABLE_MODULES = YES;
229 | CLANG_ENABLE_OBJC_ARC = YES;
230 | CLANG_WARN_BOOL_CONVERSION = YES;
231 | CLANG_WARN_CONSTANT_CONVERSION = YES;
232 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
233 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
234 | CLANG_WARN_EMPTY_BODY = YES;
235 | CLANG_WARN_ENUM_CONVERSION = YES;
236 | CLANG_WARN_INFINITE_RECURSION = YES;
237 | CLANG_WARN_INT_CONVERSION = YES;
238 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
239 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
240 | CLANG_WARN_UNREACHABLE_CODE = YES;
241 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
242 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
243 | COPY_PHASE_STRIP = NO;
244 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
245 | ENABLE_NS_ASSERTIONS = NO;
246 | ENABLE_STRICT_OBJC_MSGSEND = YES;
247 | GCC_C_LANGUAGE_STANDARD = gnu99;
248 | GCC_NO_COMMON_BLOCKS = YES;
249 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
250 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
251 | GCC_WARN_UNDECLARED_SELECTOR = YES;
252 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
253 | GCC_WARN_UNUSED_FUNCTION = YES;
254 | GCC_WARN_UNUSED_VARIABLE = YES;
255 | IPHONEOS_DEPLOYMENT_TARGET = 10.3;
256 | MTL_ENABLE_DEBUG_INFO = NO;
257 | SDKROOT = iphoneos;
258 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
259 | VALIDATE_PRODUCT = YES;
260 | };
261 | name = Release;
262 | };
263 | 52AA6F7C1EC7345F003A477C /* Debug */ = {
264 | isa = XCBuildConfiguration;
265 | buildSettings = {
266 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
267 | INFOPLIST_FILE = SwiftWeather/Info.plist;
268 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
269 | PRODUCT_BUNDLE_IDENTIFIER = com.brianadvent.SwiftWeather;
270 | PRODUCT_NAME = "$(TARGET_NAME)";
271 | SWIFT_VERSION = 3.0;
272 | };
273 | name = Debug;
274 | };
275 | 52AA6F7D1EC7345F003A477C /* Release */ = {
276 | isa = XCBuildConfiguration;
277 | buildSettings = {
278 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
279 | INFOPLIST_FILE = SwiftWeather/Info.plist;
280 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
281 | PRODUCT_BUNDLE_IDENTIFIER = com.brianadvent.SwiftWeather;
282 | PRODUCT_NAME = "$(TARGET_NAME)";
283 | SWIFT_VERSION = 3.0;
284 | };
285 | name = Release;
286 | };
287 | /* End XCBuildConfiguration section */
288 |
289 | /* Begin XCConfigurationList section */
290 | 52AA6F641EC7345F003A477C /* Build configuration list for PBXProject "SwiftWeather" */ = {
291 | isa = XCConfigurationList;
292 | buildConfigurations = (
293 | 52AA6F791EC7345F003A477C /* Debug */,
294 | 52AA6F7A1EC7345F003A477C /* Release */,
295 | );
296 | defaultConfigurationIsVisible = 0;
297 | defaultConfigurationName = Release;
298 | };
299 | 52AA6F7B1EC7345F003A477C /* Build configuration list for PBXNativeTarget "SwiftWeather" */ = {
300 | isa = XCConfigurationList;
301 | buildConfigurations = (
302 | 52AA6F7C1EC7345F003A477C /* Debug */,
303 | 52AA6F7D1EC7345F003A477C /* Release */,
304 | );
305 | defaultConfigurationIsVisible = 0;
306 | };
307 | /* End XCConfigurationList section */
308 | };
309 | rootObject = 52AA6F611EC7345F003A477C /* Project object */;
310 | }
311 |
--------------------------------------------------------------------------------