Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

画像読み込みのために Kingfisher を導入 #1

Merged
merged 2 commits into from
Feb 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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