-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathFullScreenImageViewController.swift
More file actions
62 lines (44 loc) · 1.36 KB
/
FullScreenImageViewController.swift
File metadata and controls
62 lines (44 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// FullScreenImageViewController.swift
// Example
//
// Created by Nacho Soto on 12/1/18.
// Copyright © 2018 Nacho Soto. All rights reserved.
//
import UIKit
import AsyncImageView
final class FullScreenImageViewController: UIViewController {
init(image: FlickrImageData) {
self.image = image
super.init(nibName: nil, bundle: nil)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func loadView() {
self.view = self.customView
}
// MARK: -
private lazy var customView: View = {
return View(image: self.image)
}()
private let image: FlickrImageData
}
private final class View: UIView {
init(image: FlickrImageData) {
self.imageView = Photos.createAspectFitView(initialFrame: .zero)
super.init(frame: .zero)
self.backgroundColor = .black
self.addSubview(self.imageView)
self.imageView.data = Photos.Data(imageData: image)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func layoutSubviews() {
super.layoutSubviews()
self.imageView.frame = self.bounds
}
// MARK: -
private let imageView: Photos.ImageView
}