Skip to content

Commit 818a5e9

Browse files
committed
Merge branch 'Part6' of https://github.com/jquave/Swift-Tutorial into Part6
Conflicts: TestSwift/Classes/DetailsViewController.swift TestSwift/SearchResultsViewController.swift
2 parents 67fad2c + 69e1ad7 commit 818a5e9

File tree

4 files changed

+41
-11
lines changed

4 files changed

+41
-11
lines changed

TestSwift/APIController.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,19 @@
66
// Copyright (c) 2014 JQ Software LLC. All rights reserved.
77
//
88

9-
import UIKit
9+
import Foundation
1010

1111
protocol APIControllerProtocol {
1212
func didRecieveAPIResults(results: NSDictionary)
1313
}
1414

15-
class APIController: NSObject {
15+
class APIController {
1616

1717
let data: NSMutableData = NSMutableData()
1818
var delegate: APIControllerProtocol?
1919

20+
init(){}
21+
2022
func searchItunesFor(searchTerm: String) {
2123

2224
// The iTunes API wants multiple terms separated by + symbols, so replace spaces with + signs

TestSwift/Base.lproj/Main.storyboard

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
</connections>
4545
</tableViewCell>
4646
</prototypes>
47+
<variation key="widthClass=compact" fixedFrame="YES">
48+
<rect key="frame" x="0.0" y="37" width="320" height="443"/>
49+
</variation>
4750
<connections>
4851
<outlet property="dataSource" destination="BYZ-38-t0r" id="Rph-up-PTP"/>
4952
<outlet property="delegate" destination="BYZ-38-t0r" id="zEB-7D-wXK"/>
@@ -62,10 +65,10 @@
6265
</objects>
6366
<point key="canvasLocation" x="434" y="183"/>
6467
</scene>
65-
<!--View Controller-->
68+
<!--Details View Controller-->
6669
<scene sceneID="Iya-oL-ejU">
6770
<objects>
68-
<viewController id="rSr-uw-pic" sceneMemberID="viewController">
71+
<viewController id="rSr-uw-pic" customClass="DetailsViewController" customModule="TestSwift" customModuleProvider="target" sceneMemberID="viewController">
6972
<layoutGuides>
7073
<viewControllerLayoutGuide type="top" id="smX-3l-Dxh"/>
7174
<viewControllerLayoutGuide type="bottom" id="RoX-md-gkS"/>
@@ -79,6 +82,9 @@
7982
<fontDescription key="fontDescription" name="HelveticaNeue-Light" family="Helvetica Neue" pointSize="33"/>
8083
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
8184
<nil key="highlightedColor"/>
85+
<variation key="widthClass=compact" fixedFrame="YES">
86+
<rect key="frame" x="71" y="71" width="179" height="52"/>
87+
</variation>
8288
</label>
8389
</subviews>
8490
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>

TestSwift/Classes/DetailsViewController.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ import UIKit
1010

1111
class DetailsViewController: UIViewController {
1212

13-
var albumInfo: Album?
14-
15-
init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
16-
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
17-
// Custom initialization
13+
var detailInfo: NSDictionary?
14+
15+
init(coder aDecoder: NSCoder!) {
16+
super.init(coder: aDecoder)
1817
}
19-
18+
2019
override func viewDidLoad() {
2120
super.viewDidLoad()
2221

TestSwift/SearchResultsViewController.swift

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,34 @@ class SearchResultsViewController: UIViewController,/* UITableViewDataSource, UI
2222

2323
override func viewDidLoad() {
2424
super.viewDidLoad()
25-
api.delegate = self
25+
self.api.delegate = self
2626
UIApplication.sharedApplication().networkActivityIndicatorVisible = true
2727
api.searchItunesFor("Bob Dylan");
2828
}
2929

30+
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject) {
31+
var detailsViewController: DetailsViewController = segue.destinationViewController as DetailsViewController
32+
}
33+
34+
/*
35+
36+
if segue.identifier == "Details" {
37+
//var detailsViewController: DetailsViewController? = segue.destinationViewController! as? DetailsViewController
38+
39+
var destinationViewController: UIViewController = segue.destinationViewController as UIViewController
40+
41+
// var detailsViewController: DetailsViewController = destinationViewController as DetailsViewController
42+
43+
44+
//var destinationViewController: UIViewController! = segue.destinationViewController as UIViewController!
45+
//var detailsViewController: DetailsViewController = destinationViewController as DetailsViewController
46+
/* var selectedIndexPathRow = appsTableView.indexPathForSelectedRow().row
47+
var selectedAppDetails: NSDictionary = self.tableData[selectedIndexPathRow] as NSDictionary
48+
49+
detailsViewController.detailInfo = selectedAppDetails*/
50+
}
51+
}*/
52+
3053
func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int {
3154
return albums.count
3255
}

0 commit comments

Comments
 (0)