Skip to content

Commit 7709288

Browse files
committed
Part 6
1 parent 818a5e9 commit 7709288

File tree

6 files changed

+78
-193
lines changed

6 files changed

+78
-193
lines changed

TestSwift.xcodeproj/xcuserdata/jquave.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

Lines changed: 0 additions & 115 deletions
This file was deleted.

TestSwift/APIController.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ protocol APIControllerProtocol {
1414

1515
class APIController {
1616

17-
let data: NSMutableData = NSMutableData()
1817
var delegate: APIControllerProtocol?
1918

20-
init(){}
19+
init(delegate: APIControllerProtocol?) {
20+
self.delegate = delegate
21+
}
2122

2223
func searchItunesFor(searchTerm: String) {
2324

@@ -42,6 +43,7 @@ class APIController {
4243
println("HTTP Error: \(error?.localizedDescription)")
4344
}
4445
else {
46+
println("Results recieved")
4547
self.delegate?.didRecieveAPIResults(jsonResult)
4648
}
4749
}

TestSwift/Base.lproj/Main.storyboard

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
22
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6154.17" systemVersion="13D65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="18C-lM-Kii">
33
<dependencies>
4+
<deployment defaultVersion="1536" identifier="iOS"/>
45
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6153.11"/>
56
</dependencies>
67
<scenes>
@@ -63,12 +64,12 @@
6364
</viewController>
6465
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
6566
</objects>
66-
<point key="canvasLocation" x="434" y="183"/>
67+
<point key="canvasLocation" x="313.5" y="183"/>
6768
</scene>
6869
<!--Details View Controller-->
6970
<scene sceneID="Iya-oL-ejU">
7071
<objects>
71-
<viewController id="rSr-uw-pic" customClass="DetailsViewController" customModule="TestSwift" customModuleProvider="target" sceneMemberID="viewController">
72+
<viewController storyboardIdentifier="DetailsViewController" id="rSr-uw-pic" customClass="DetailsViewController" customModule="TestSwift" customModuleProvider="target" sceneMemberID="viewController">
7273
<layoutGuides>
7374
<viewControllerLayoutGuide type="top" id="smX-3l-Dxh"/>
7475
<viewControllerLayoutGuide type="bottom" id="RoX-md-gkS"/>
@@ -79,22 +80,67 @@
7980
<subviews>
8081
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="X4G-YW-dpA">
8182
<rect key="frame" x="97" y="71" width="287" height="52"/>
82-
<fontDescription key="fontDescription" name="HelveticaNeue-Light" family="Helvetica Neue" pointSize="33"/>
83+
<fontDescription key="fontDescription" name="HelveticaNeue-UltraLight" family="Helvetica Neue" pointSize="35"/>
8384
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
8485
<nil key="highlightedColor"/>
8586
<variation key="widthClass=compact" fixedFrame="YES">
86-
<rect key="frame" x="71" y="71" width="179" height="52"/>
87+
<rect key="frame" x="128" y="71" width="183" height="100"/>
8788
</variation>
8889
</label>
90+
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="vzM-nB-nVu">
91+
<rect key="frame" x="0.0" y="0.0" width="240" height="128"/>
92+
<variation key="widthClass=compact" fixedFrame="YES">
93+
<rect key="frame" x="20" y="71" width="100" height="100"/>
94+
</variation>
95+
</imageView>
96+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="cq6-mO-3CH">
97+
<rect key="frame" x="-23" y="-15" width="46" height="30"/>
98+
<state key="normal" title="Open">
99+
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
100+
</state>
101+
<variation key="widthClass=compact" fixedFrame="YES">
102+
<rect key="frame" x="88" y="395" width="145" height="65"/>
103+
</variation>
104+
</button>
105+
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="vCj-Rl-lyv">
106+
<rect key="frame" x="0.0" y="0.0" width="240" height="128"/>
107+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
108+
<string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
109+
<fontDescription key="fontDescription" type="system" pointSize="14"/>
110+
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
111+
<variation key="widthClass=compact" fixedFrame="YES">
112+
<rect key="frame" x="20" y="179" width="291" height="208"/>
113+
</variation>
114+
</textView>
89115
</subviews>
90116
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
91117
<simulatedOrientationMetrics key="simulatedOrientationMetrics" orientation="landscapeRight"/>
118+
<variation key="default">
119+
<mask key="subviews">
120+
<exclude reference="vzM-nB-nVu"/>
121+
<exclude reference="cq6-mO-3CH"/>
122+
<exclude reference="vCj-Rl-lyv"/>
123+
</mask>
124+
</variation>
125+
<variation key="widthClass=compact">
126+
<mask key="subviews">
127+
<include reference="vzM-nB-nVu"/>
128+
<include reference="cq6-mO-3CH"/>
129+
<include reference="vCj-Rl-lyv"/>
130+
</mask>
131+
</variation>
92132
</view>
93133
<navigationItem key="navigationItem" id="LRU-cs-sJU"/>
134+
<connections>
135+
<outlet property="albumCover" destination="vzM-nB-nVu" id="9LD-H2-2p1"/>
136+
<outlet property="detailsTextView" destination="vCj-Rl-lyv" id="6pt-6a-gDC"/>
137+
<outlet property="openButton" destination="cq6-mO-3CH" id="fgP-O6-myn"/>
138+
<outlet property="titleLabel" destination="X4G-YW-dpA" id="91I-eF-tB4"/>
139+
</connections>
94140
</viewController>
95141
<placeholder placeholderIdentifier="IBFirstResponder" id="jMh-ub-mcV" userLabel="First Responder" sceneMemberID="firstResponder"/>
96142
</objects>
97-
<point key="canvasLocation" x="1005" y="183"/>
143+
<point key="canvasLocation" x="891" y="183"/>
98144
</scene>
99145
<!--Navigation Controller-->
100146
<scene sceneID="YYH-df-0Po">

TestSwift/Classes/Album.swift

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

9-
import UIKit
10-
11-
class Album: NSObject {
9+
class Album {
1210

13-
var title: String = "N/A"
14-
var price: String = "N/A"
11+
var title: String?
12+
var price: String?
1513
var thumbnailImageURL: String?
1614
var largeImageURL: String?
1715
var itemURL: String?
1816
var artistURL: String?
1917

20-
21-
init(name: String, price: String, thumbnailImageURL: String, largeImageURL: String, itemURL: String, artistURL: String) {
18+
init(name: String!, price: String!, thumbnailImageURL: String!, largeImageURL: String!, itemURL: String!, artistURL: String!) {
2219
self.title = name
2320
self.price = price
2421
self.thumbnailImageURL = thumbnailImageURL
2522
self.largeImageURL = largeImageURL
2623
self.itemURL = itemURL
2724
self.artistURL = artistURL
2825
}
29-
3026
}

TestSwift/Classes/DetailsViewController.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ import UIKit
1010

1111
class DetailsViewController: UIViewController {
1212

13-
var detailInfo: NSDictionary?
13+
@IBOutlet var albumCover : UIImageView
14+
@IBOutlet var titleLabel : UILabel
15+
@IBOutlet var detailsTextView : UITextView
16+
@IBOutlet var openButton : UIButton
17+
18+
var album: Album?
1419

1520
init(coder aDecoder: NSCoder!) {
1621
super.init(coder: aDecoder)
1722
}
1823

1924
override func viewDidLoad() {
2025
super.viewDidLoad()
21-
22-
// Do any additional setup after loading the view.
23-
}
24-
25-
override func didReceiveMemoryWarning() {
26-
super.didReceiveMemoryWarning()
27-
// Dispose of any resources that can be recreated.
26+
titleLabel.text = self.album?.title
27+
albumCover.image = UIImage(data: NSData(contentsOfURL: NSURL(string: self.album?.largeImageURL)))
2828
}
2929

3030
}

0 commit comments

Comments
 (0)