Skip to content

Commit b3f3309

Browse files
committed
Create a model for tracks
1 parent a97fbb8 commit b3f3309

File tree

4 files changed

+39
-2
lines changed

4 files changed

+39
-2
lines changed

TestSwift.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
021E1AEF1944CDDE00FDC37C /* Track.swift in Sources */ = {isa = PBXBuildFile; fileRef = 021E1AEE1944CDDE00FDC37C /* Track.swift */; };
1011
022889EF193FC3AC00D729A0 /* DetailsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 022889EE193FC3AC00D729A0 /* DetailsViewController.swift */; };
1112
022889F1193FD6C000D729A0 /* Album.swift in Sources */ = {isa = PBXBuildFile; fileRef = 022889F0193FD6C000D729A0 /* Album.swift */; };
1213
0229AE63193F97EF00BCED97 /* Blank52.png in Resources */ = {isa = PBXBuildFile; fileRef = 0229AE62193F97EF00BCED97 /* Blank52.png */; };
@@ -29,6 +30,7 @@
2930
/* End PBXContainerItemProxy section */
3031

3132
/* Begin PBXFileReference section */
33+
021E1AEE1944CDDE00FDC37C /* Track.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Track.swift; path = Classes/Track.swift; sourceTree = "<group>"; };
3234
022889EE193FC3AC00D729A0 /* DetailsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DetailsViewController.swift; path = Classes/DetailsViewController.swift; sourceTree = "<group>"; };
3335
022889F0193FD6C000D729A0 /* Album.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Album.swift; path = Classes/Album.swift; sourceTree = "<group>"; };
3436
0229AE62193F97EF00BCED97 /* Blank52.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Blank52.png; sourceTree = "<group>"; };
@@ -77,6 +79,7 @@
7779
isa = PBXGroup;
7880
children = (
7981
022889F0193FD6C000D729A0 /* Album.swift */,
82+
021E1AEE1944CDDE00FDC37C /* Track.swift */,
8083
);
8184
name = Model;
8285
sourceTree = "<group>";
@@ -260,6 +263,7 @@
260263
02F504DB193E0B630037F599 /* APIController.swift in Sources */,
261264
022889EF193FC3AC00D729A0 /* DetailsViewController.swift in Sources */,
262265
022889F1193FD6C000D729A0 /* Album.swift in Sources */,
266+
021E1AEF1944CDDE00FDC37C /* Track.swift in Sources */,
263267
);
264268
runOnlyForDeploymentPostprocessing = 0;
265269
};

TestSwift/Base.lproj/Main.storyboard

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
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"/>
54
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6153.11"/>
65
</dependencies>
76
<scenes>
@@ -118,6 +117,10 @@
118117
<variation key="heightClass=regular-widthClass=compact" ambiguous="YES" misplaced="YES">
119118
<rect key="frame" x="20" y="179" width="280" height="461"/>
120119
</variation>
120+
<connections>
121+
<outlet property="dataSource" destination="rSr-uw-pic" id="Atq-D3-Xvo"/>
122+
<outlet property="delegate" destination="rSr-uw-pic" id="aAg-9A-Leh"/>
123+
</connections>
121124
</tableView>
122125
</subviews>
123126
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>

TestSwift/Classes/DetailsViewController.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88

99
import UIKit
1010

11-
class DetailsViewController: UIViewController {
11+
class DetailsViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
1212

1313
@IBOutlet var albumCover : UIImageView
1414
@IBOutlet var titleLabel : UILabel
1515

1616
var album: Album?
17+
var tracks: Track[] = []
1718

1819
init(coder aDecoder: NSCoder!) {
1920
super.init(coder: aDecoder)
@@ -24,5 +25,14 @@ class DetailsViewController: UIViewController {
2425
titleLabel.text = self.album?.title
2526
albumCover.image = UIImage(data: NSData(contentsOfURL: NSURL(string: self.album?.largeImageURL)))
2627
}
28+
29+
30+
func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int {
31+
return 0
32+
}
33+
34+
func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
35+
return nil
36+
}
2737

2838
}

TestSwift/Classes/Track.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//
2+
// Track.swift
3+
// TestSwift
4+
//
5+
// Created by Jameson Quave on 6/8/14.
6+
// Copyright (c) 2014 JQ Software LLC. All rights reserved.
7+
//
8+
9+
class Track {
10+
11+
var title: String?
12+
var price: String?
13+
var previewUrl: String?
14+
15+
init(name: String!, price: String!, previewUrl: String!) {
16+
self.title = name
17+
self.price = price
18+
self.previewUrl = previewUrl
19+
}
20+
}

0 commit comments

Comments
 (0)