Skip to content

Commit

Permalink
Merge pull request #1 from zdogma/devel/introduce_Kingfisher
Browse files Browse the repository at this point in the history
画像読み込みのために Kingfisher を導入
  • Loading branch information
zdogma committed Feb 21, 2017
2 parents 3af41a9 + de283da commit 76750b2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
17 changes: 4 additions & 13 deletions AikatsuLyric/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import UIKit
import Kingfisher

class ViewController: UIViewController, UIWebViewDelegate {

Expand All @@ -31,7 +32,6 @@ class ViewController: UIViewController, UIWebViewDelegate {

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.

self.automaticallyAdjustsScrollViewInsets = false

Expand All @@ -46,18 +46,9 @@ class ViewController: UIViewController, UIWebViewDelegate {

// サムネイル画像
if !data!.thumbnail_url.isEmpty {
let configuration = URLSessionConfiguration.default
let session = URLSession(configuration: configuration, delegate: nil, delegateQueue: OperationQueue.main)

let url = NSURL(string: data!.thumbnail_url)
let request = NSURLRequest(url: url as! URL)

session.dataTask(with: request as URLRequest, completionHandler: {
(data, response, err) in

let image = UIImage(data: data!)
self.songThumbnailImage.image = image
})
let url = URL(string: data!.thumbnail_url)
let placeholderImage = UIImage(named: "NoImage")
self.songThumbnailImage.kf.setImage(with: url, placeholder: placeholderImage)
}

// Youtube動画
Expand Down
1 change: 1 addition & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ target 'AikatsuLyric' do

# Pods for AikatsuLyric
pod 'SwiftyJSON', '~> 3.0.0'
pod 'Kingfisher', '~> 3.0'
end
5 changes: 4 additions & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
PODS:
- Kingfisher (3.4.0)
- SwiftyJSON (3.0.0)

DEPENDENCIES:
- Kingfisher (~> 3.0)
- SwiftyJSON (~> 3.0.0)

SPEC CHECKSUMS:
Kingfisher: 5690cfb3d1bddf3a98d679a3a34d0b7294974ed2
SwiftyJSON: f57b2b44bc166617372d1c70773591fe9f0f5fd4

PODFILE CHECKSUM: c8f77232ebe85cd5a9baadb2fa4777c0adac320c
PODFILE CHECKSUM: 5b9ca8858dc02bf58f01528c7943c6c99f869fc4

COCOAPODS: 1.2.0

0 comments on commit 76750b2

Please sign in to comment.