@@ -10,7 +10,7 @@ import UIKit
10
10
11
11
class SearchResultsViewController : UIViewController , UITableViewDataSource , UITableViewDelegate , APIControllerProtocol {
12
12
13
- let kCellIdentifier : String = " SearchResultCell "
13
+ let kCellIdentifier = " SearchResultCell "
14
14
15
15
var api : APIController ?
16
16
@@ -43,7 +43,7 @@ class SearchResultsViewController: UIViewController, UITableViewDataSource, UITa
43
43
44
44
func tableView( tableView: UITableView ! , cellForRowAtIndexPath indexPath: NSIndexPath ! ) -> UITableViewCell ! {
45
45
46
- var cell : UITableViewCell = tableView. dequeueReusableCellWithIdentifier ( kCellIdentifier) as UITableViewCell
46
+ var cell = tableView. dequeueReusableCellWithIdentifier ( kCellIdentifier) as UITableViewCell
47
47
48
48
// Find this cell's album by passing in the indexPath.row to the subscript method for an array of type Album[]
49
49
let album = self . albums [ indexPath. row]
@@ -63,11 +63,11 @@ class SearchResultsViewController: UIViewController, UITableViewDataSource, UITa
63
63
64
64
if ( !image? ) {
65
65
// If the image does not exist, we need to download it
66
- let imgURL : NSURL = NSURL ( string: urlString)
66
+ let imgURL = NSURL ( string: urlString)
67
67
68
68
// Download an NSData representation of the image at the URL
69
- let request : NSURLRequest = NSURLRequest ( URL: imgURL)
70
- let urlConnection : NSURLConnection = NSURLConnection ( request: request, delegate: self )
69
+ let request = NSURLRequest ( URL: imgURL)
70
+ let urlConnection = NSURLConnection ( request: request, delegate: self )
71
71
NSURLConnection . sendAsynchronousRequest ( request, queue: NSOperationQueue . mainQueue ( ) , completionHandler: { ( response: NSURLResponse!, data: NSData!, error: NSError!) - > Void in
72
72
if !error? {
73
73
image = UIImage ( data: data)
@@ -106,15 +106,15 @@ class SearchResultsViewController: UIViewController, UITableViewDataSource, UITa
106
106
let allResults : NSDictionary [ ] = results [ " results " ] as NSDictionary [ ]
107
107
108
108
// Sometimes iTunes returns a collection, not a track, so we check both for the 'name'
109
- for result : NSDictionary in allResults {
109
+ for result in allResults {
110
110
111
- var name : String ? = result [ " trackName " ] as? String
111
+ var name = result [ " trackName " ] as? String
112
112
if !name? {
113
113
name = result [ " collectionName " ] as? String
114
114
}
115
115
116
116
// Sometimes price comes in as formattedPrice, sometimes as collectionPrice.. and sometimes it's a float instead of a string. Hooray!
117
- var price : String ? = result [ " formattedPrice " ] as? String
117
+ var price = result [ " formattedPrice " ] as? String
118
118
if !price? {
119
119
price = result [ " collectionPrice " ] as? String
120
120
if !price? {
@@ -127,11 +127,11 @@ class SearchResultsViewController: UIViewController, UITableViewDataSource, UITa
127
127
}
128
128
}
129
129
130
- let thumbnailURL : String ? = result [ " artworkUrl60 " ] as? String
131
- let imageURL : String ? = result [ " artworkUrl100 " ] as? String
132
- let artistURL : String ? = result [ " artistViewUrl " ] as? String
130
+ let thumbnailURL = result [ " artworkUrl60 " ] as? String
131
+ let imageURL = result [ " artworkUrl100 " ] as? String
132
+ let artistURL = result [ " artistViewUrl " ] as? String
133
133
134
- var itemURL : String ? = result [ " collectionViewUrl " ] as? String
134
+ var itemURL = result [ " collectionViewUrl " ] as? String
135
135
if !itemURL? {
136
136
itemURL = result [ " trackViewUrl " ] as? String
137
137
}
0 commit comments