42 Commits

Author SHA1 Message Date
Khoa Pham eb4b12f633 Bump 1.1.0 2017-10-03 13:34:07 +02:00
Khoa Pham c00d8b62dd Update demo 2017-10-03 13:31:18 +02:00
Khoa Pham 0d60426da2 Lock to 2.0 2017-10-03 13:28:30 +02:00
Khoa Pham fec46dbd52 Merge pull request #138 from TParizek/master
Specified Hue dependency version in podspec - Issue 137
2017-10-03 13:26:01 +02:00
Tomáš Pařízek 54da63c4a1 Specified Hue dependency version in podspec 2017-10-02 14:16:02 +02:00
Christoffer Winterkvist ec1200faea Merge pull request #129 from r-mckay/feature/useSwiftLint
project: use swiftlint and fix triggered warnings
2017-09-03 14:32:32 +02:00
Romain Bertozzi f0825e09d5 source: fix SwiftLint unused closure parameters
This commit fixes several warnings concerning unused closure parameters.
2017-09-02 12:23:47 -04:00
Romain Bertozzi 1e354c2675 source: fix SwiftLint option redondant init
This commit fixes a SwiftLint Option Redondant Initialization warning in
a file.
2017-09-02 12:19:36 -04:00
Romain Bertozzi eade5ac4c8 source: fix SwiftLint colon violation
This commit takes care of fixing a SwiftLint Colon Violation in a file.
2017-09-02 12:19:36 -04:00
Romain Bertozzi 8a33f9529b source: fix SwiftLint parameter alignement violation
This commit aligns parameters in a call to fix a SwiftLint warning.
2017-09-02 12:19:36 -04:00
Romain Bertozzi 4abeb93ac7 source: remove trailing spaces
This commit solves the SwiftLint warning concerning the trailing spaces.
2017-09-02 12:19:36 -04:00
Romain Bertozzi 619f84d89e project: add build phase running SwiftLint
This commit adds a build phase to the project to run SwiftLint. This new
phase follows the implementation made in the ImagePicker project [1].

This commit does not try to handle the eventual warning that could be
raised by the static code analysis.

[1] https://github.com/hyperoslo/ImagePicker
2017-09-02 12:19:36 -04:00
Christoffer Winterkvist 9531315c94 Merge pull request #123 from ShaneQi/fix_hide_status_bar_and_footer_gradient
Fixed two bugs.
2017-09-01 09:03:37 +02:00
Vadym Markov cfafbbcb14 Merge pull request #127 from r-mckay/fix/resolveWarning
lightboxController: fix warning
2017-08-27 19:40:37 +02:00
Shane Qi 6a6096e0b8 Fixed footer view gradient.
Should remove gradient layer if infoLabel's text is empty, regardless expanded state.

This is a override commit, in order to run CI again.
2017-08-26 19:54:37 -05:00
Romain Bertozzi 1480a44dfb lightboxController: fix warning
This commit fixes a warning indicating that a variable value was never
mutated and should be a constant.

To fix this warning we actually replace the 'var' by a 'let'.
2017-08-26 17:45:00 -04:00
Christoffer Winterkvist 2687d175c1 Merge pull request #128 from r-mckay/fix/continuousIntegration
project: update continuous integration setup
2017-08-26 13:51:32 +02:00
Romain Bertozzi c84682d3d9 project: update continuous integration setup
This commit updates the continuous integration setup by selecting the
Xcode 8.3 osx_image and by indicating that the project is written in
swift.
2017-08-25 16:12:33 -04:00
Shane Qi 6627936d23 Fixed status bar hidden config.
Switched from `UIApplication.shared.setStatusBarHidden` to `prefersStatusBarHidden`.
2017-07-13 18:06:38 -05:00
onmyway133 b26ee135bc Merge pull request #120 from vitalii-tym/fix/issue108
Updating the image frames while images are still being loaded
2017-06-20 15:11:00 +02:00
onmyway133 96d7da82bb Merge pull request #119 from vitalii-tym/fix/issue117
Cutting long texts quicker
2017-06-20 15:07:01 +02:00
onmyway133 9707c7cfe4 Merge pull request #122 from vitalii-tym/improvement/accessible-images
Updating the .image property of a LightboxImage instance after Lightbox has downloaded an image via URL
2017-06-20 11:31:28 +02:00
Vitaliy Tim 4968853f8c Made image property of LightBox images accessible after the image has been loaded via URL 2017-06-20 11:29:48 +03:00
Vitaliy Tim 053735d408 Properly updating the image frames while images are still being loaded, so that activity indicators are correcty shown 2017-06-20 10:59:38 +03:00
Vitaliy Tim 6052398040 Speeding up cutting process for long texts 2017-06-20 10:39:18 +03:00
onmyway133 df48ce7b85 Merge pull request #112 from danwilliams64/fix/screen_bounds
Use key window bounds instead of screen bounds
2017-06-19 12:46:00 +02:00
Dan Williams eb44646978 Use app delegate's window instead of screen bounds 2017-06-19 11:30:35 +01:00
onmyway133 6686d8f83b Merge pull request #113 from vitalii-tym/master
Preserve correct Navigation Bar after dismissal when opened from a controller with a Nav Bar
2017-06-19 11:30:30 +02:00
Vitaliy Tim 03be7479f4 Fixes an issue with Navigation Bar, which had wrong position after the lightbox has been dismissed 2017-06-19 11:50:09 +03:00
Christoffer Winterkvist 3b54e8959d Merge pull request #107 from hyperoslo/improve/dynamic-background
Fix dynamic background loading
2017-04-25 12:33:20 +02:00
Christoffer Winterkvist 69813ee7fe Fix dynamic background loading
Because `loadDynamicBackground` is called in `remoteImageDidLoad`, it
can end up flickering between all images as they are loaded from the
network. To fix this issue there is a now a small safeguard in
`remoteImageDidLoad` to evaluate if the image view is on screen,
otherwise just return early and don't switch out the background.

The `PageViewDelegate` has been slightly modified to return the image
view when loading remote images, that image view is used in the safe
guard mentioned earlier.

The `addìmageTo` now uses a weak reference to reduce the chance of
holding reference.

`addGradientLayer` now uses `@discardableResult` so that you don't have
to assign it to a variable when using the method.

The `goTo` method in `LightboxController` will no disregard the
animation if the controller is not on screen. This is done by checking
if the controller's view as a window or not.
2017-04-25 07:28:13 +02:00
Vadym Markov 4ccab620d6 Merge pull request #104 from rmnblm/master
Auto-size Close and Delete buttons
2017-04-21 09:37:55 +02:00
Roman Blum 3ea5a88e01 change 4 spaces to 2 spaces 2017-04-21 09:36:51 +02:00
Roman Blum 2b9216b1b8 auto-size Close and Delete buttons 2017-03-14 09:26:02 +01:00
Khoa Pham 48f307b003 Merge pull request #103 from rmnblm/master
Fix half-black screen after dismissal
2017-03-02 15:00:16 +01:00
Roman Blum eb44c67f69 Fix half-black screen after dismissal 2017-03-02 12:06:42 +01:00
John Sundell e6452f116e Merge pull request #94 from basecom/master
Added new protocol LightboxControllerTouchDelegate
2017-02-14 09:56:02 +01:00
Christoph Dieckmann 96c660a424 Added new protocol LightboxControllerTouchDelegate to delegate the touch event to the calling object. 2017-02-07 14:35:16 +01:00
Vadym Markov 4833dcde35 Update README.md 2016-12-21 15:17:16 +01:00
Vadym Markov 8f907c1fe9 Update README.md 2016-12-21 15:10:40 +01:00
Vadym Markov e314fea3e7 Update summary 2016-12-21 14:36:07 +01:00
Vadym Markov b4ec75ca27 Add swift version 2016-12-21 14:34:18 +01:00
17 changed files with 116 additions and 56 deletions
+1
View File
@@ -0,0 +1 @@
3.0
+2 -2
View File
@@ -1,5 +1,5 @@
osx_image: xcode8
language: objective-c
osx_image: xcode8.3
language: swift
before_install:
- brew update
+1 -1
View File
@@ -1 +1 @@
github "hyperoslo/Hue" "master"
github "hyperoslo/Hue" ~> 2.0
@@ -164,13 +164,16 @@
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-DemoLightbox-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
3BCDC27EE322C46C109D231B /* [CP] Copy Pods Resources */ = {
@@ -194,9 +197,14 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-DemoLightbox/Pods-DemoLightbox-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Hue/Hue.framework",
"${BUILT_PRODUCTS_DIR}/Lightbox/Lightbox.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Hue.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Lightbox.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
+4 -4
View File
@@ -1,19 +1,19 @@
PODS:
- Hue (2.0.1)
- Lightbox (1.0.0):
- Hue
- Hue (~> 2.0)
DEPENDENCIES:
- Lightbox (from `../../`)
EXTERNAL SOURCES:
Lightbox:
:path: "../../"
:path: ../../
SPEC CHECKSUMS:
Hue: 354caec055fdc9d38b5ef33ca2e7224721843baf
Lightbox: eb4196a846a883c4c2a52209b29b283d1bc706e1
Lightbox: d15b5e265e505009932fa447f27b5262b8b1b604
PODFILE CHECKSUM: cd88b68c201e5c39cef62070056649eaee91c71b
COCOAPODS: 1.1.1
COCOAPODS: 1.3.1
+4 -4
View File
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "Lightbox"
s.summary = "A short description of Lightbox."
s.version = "1.0.0"
s.summary = "A a convenient and easy to use image viewer for your iOS app, packed with all the features you expect"
s.version = "1.1.0"
s.homepage = "https://github.com/hyperoslo/Lightbox"
s.license = 'MIT'
s.author = { "Hyper Interaktiv AS" => "ios@hyper.no" }
@@ -13,7 +13,7 @@ Pod::Spec.new do |s|
s.ios.resource = 'Resources/Lightbox.bundle'
s.frameworks = 'UIKit', 'AVFoundation', 'AVKit'
s.dependency 'Hue'
s.dependency 'Hue', '~> 2.0'
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '3.0' }
end
+14
View File
@@ -146,6 +146,7 @@
D523B0A61C43AA2A001AD1EC /* Headers */,
D523B0A71C43AA2A001AD1EC /* Resources */,
D54DFCC41C5AAAF600ADEA0E /* Copy frameworks with Carthage */,
5CF8A88D1F50B4EA00C28475 /* ShellScript */,
);
buildRules = (
);
@@ -200,6 +201,19 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
5CF8A88D1F50B4EA00C28475 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which swiftlint >/dev/null; then\nswiftlint\nelse\necho \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi";
};
D54DFCC41C5AAAF600ADEA0E /* Copy frameworks with Carthage */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
+2
View File
@@ -7,6 +7,8 @@
[![Platform](https://img.shields.io/cocoapods/p/Lightbox.svg?style=flat)](http://cocoadocs.org/docsets/Lightbox)
![Swift](https://img.shields.io/badge/%20in-swift%203.0-orange.svg)
[Demo](https://appetize.io/app/wfgwc2uvg82m9pzbt17p4rrgh4?device=iphone5s&scale=75&orientation=portrait&osVersion=9.3)
<img src="https://raw.githubusercontent.com/hyperoslo/Lightbox/master/Images/Icon.png" alt="Lightbox Icon" align="right" />
**Lightbox** is a convenient and easy to use image viewer for your iOS app,
+6 -4
View File
@@ -111,8 +111,8 @@ extension LightboxTransition: UIViewControllerAnimatedTransitioning {
func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
let container = transitionContext.containerView
guard let fromView = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from)?.view,
let toView = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)?.view
guard let fromView = transitionContext.view(forKey: UITransitionContextViewKey.from),
let toView = transitionContext.view(forKey: UITransitionContextViewKey.to)
else { return }
let firstView = dismissing ? toView : fromView
@@ -123,6 +123,8 @@ extension LightboxTransition: UIViewControllerAnimatedTransitioning {
container.addSubview(firstView)
container.addSubview(secondView)
toView.frame = container.bounds
let duration = transitionDuration(using: transitionContext)
UIView.animate(withDuration: duration, animations: {
@@ -145,8 +147,8 @@ extension LightboxTransition: UIViewControllerTransitioningDelegate {
}
func animationController(forPresented presented: UIViewController,
presenting: UIViewController,
source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
presenting: UIViewController,
source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
dismissing = false
return self
}
+1 -1
View File
@@ -2,7 +2,7 @@ import UIKit
extension UIView {
func addGradientLayer(_ colors: [UIColor]) -> CAGradientLayer {
@discardableResult func addGradientLayer(_ colors: [UIColor]) -> CAGradientLayer {
if let gradientLayer = gradientLayer { return gradientLayer }
let gradient = CAGradientLayer()
+5 -5
View File
@@ -15,7 +15,7 @@ open class LightboxConfig {
NSURLConnection.sendAsynchronousRequest(imageRequest,
queue: OperationQueue.main,
completionHandler: { response, data, error in
completionHandler: { _, data, error in
if let data = data, let image = UIImage(data: data) {
imageView.image = image
}
@@ -50,7 +50,7 @@ open class LightboxConfig {
public struct CloseButton {
public static var enabled = true
public static var size = CGSize(width: 60, height: 25)
public static var size: CGSize?
public static var text = NSLocalizedString("Close", comment: "")
public static var image: UIImage?
@@ -67,7 +67,7 @@ open class LightboxConfig {
public struct DeleteButton {
public static var enabled = false
public static var size = CGSize(width: 70, height: 25)
public static var size: CGSize?
public static var text = NSLocalizedString("Delete", comment: "")
public static var image: UIImage?
@@ -98,8 +98,8 @@ open class LightboxConfig {
public static var minimumScale: CGFloat = 1.0
public static var maximumScale: CGFloat = 3.0
}
public struct LoadingIndicator {
public static var configure: ((UIActivityIndicatorView) -> Void)? = nil
public static var configure: ((UIActivityIndicatorView) -> Void)?
}
}
+30 -21
View File
@@ -11,6 +11,11 @@ public protocol LightboxControllerDismissalDelegate: class {
func lightboxControllerWillDismiss(_ controller: LightboxController)
}
public protocol LightboxControllerTouchDelegate: class {
func lightboxController(_ controller: LightboxController, didTouch image: LightboxImage, at index: Int)
}
open class LightboxController: UIViewController {
// MARK: - Internal views
@@ -70,14 +75,14 @@ open class LightboxController: UIViewController {
let gradient = CAGradientLayer()
let colors = [UIColor(hex: "090909").alpha(0), UIColor(hex: "040404")]
_ = view.addGradientLayer(colors)
view.addGradientLayer(colors)
view.alpha = 0
return view
}()
var screenBounds: CGRect {
return UIScreen.main.bounds
return UIApplication.shared.delegate?.window??.bounds ?? .zero
}
// MARK: - Properties
@@ -94,7 +99,7 @@ open class LightboxController: UIViewController {
pageDelegate?.lightboxController(self, didMoveToPage: currentPage)
if let image = pageViews[currentPage].imageView.image , dynamicBackground {
if let image = pageViews[currentPage].imageView.image, dynamicBackground {
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.125) {
self.loadDynamicBackground(image)
}
@@ -137,6 +142,7 @@ open class LightboxController: UIViewController {
open weak var pageDelegate: LightboxControllerPageDelegate?
open weak var dismissalDelegate: LightboxControllerDismissalDelegate?
open weak var imageTouchDelegate: LightboxControllerTouchDelegate?
open internal(set) var presented = false
open fileprivate(set) var seen = false
@@ -182,23 +188,14 @@ open class LightboxController: UIViewController {
open override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
if LightboxConfig.hideStatusBar {
UIApplication.shared.setStatusBarHidden(true, with: .fade)
}
if !presented {
presented = true
configureLayout()
}
}
open override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
if LightboxConfig.hideStatusBar {
UIApplication.shared.setStatusBarHidden(statusBarHidden, with: .fade)
}
open override var prefersStatusBarHidden: Bool {
return LightboxConfig.hideStatusBar
}
// MARK: - Rotation
@@ -206,9 +203,9 @@ open class LightboxController: UIViewController {
override open func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)
coordinator.animate(alongsideTransition: { (UIViewControllerTransitionCoordinatorContext) -> Void in
coordinator.animate(alongsideTransition: { _ in
self.configureLayout(size)
}, completion: nil)
}, completion: nil)
}
// MARK: - Configuration
@@ -240,7 +237,9 @@ open class LightboxController: UIViewController {
var offset = scrollView.contentOffset
offset.x = CGFloat(page) * (scrollView.frame.width + spacing)
scrollView.setContentOffset(offset, animated: animated)
let shouldAnimated = view.window != nil ? animated : false
scrollView.setContentOffset(offset, animated: shouldAnimated)
}
open func next(_ animated: Bool = true) {
@@ -259,7 +258,7 @@ open class LightboxController: UIViewController {
// MARK: - Layout
open func configureLayout(_ size: CGSize = UIScreen.main.bounds.size) {
open func configureLayout(_ size: CGSize = UIApplication.shared.delegate?.window??.bounds.size ?? .zero) {
scrollView.frame.size = size
scrollView.contentSize = CGSize(
width: size.width * CGFloat(numberOfPages) + spacing * CGFloat(numberOfPages - 1),
@@ -341,8 +340,16 @@ extension LightboxController: UIScrollViewDelegate {
extension LightboxController: PageViewDelegate {
func remoteImageDidLoad(_ image: UIImage?) {
guard let image = image , dynamicBackground else { return }
func remoteImageDidLoad(_ image: UIImage?, imageView: UIImageView) {
guard let image = image, dynamicBackground else {
return
}
let imageViewFrame = imageView.convert(imageView.frame, to: view)
guard view.frame.intersects(imageViewFrame) else {
return
}
loadDynamicBackground(image)
}
@@ -358,6 +365,8 @@ extension LightboxController: PageViewDelegate {
func pageViewDidTouch(_ pageView: PageView) {
guard !pageView.hasZoomed else { return }
imageTouchDelegate?.lightboxController(self, didTouch: images[currentPage], at: currentPage)
let visible = (headerView.alpha == 1.0)
toggleControls(pageView: pageView, visible: !visible)
}
@@ -412,6 +421,6 @@ extension LightboxController: FooterViewDelegate {
UIView.animate(withDuration: 0.25, animations: {
self.overlayView.alpha = expanded ? 1.0 : 0.0
self.headerView.deleteButton.alpha = expanded ? 0.0 : 1.0
})
})
}
}
+3 -2
View File
@@ -15,7 +15,7 @@ open class LightboxImage {
self.videoURL = videoURL
}
public init(imageURL: URL, text: String = "", videoURL: URL? = nil ) {
public init(imageURL: URL, text: String = "", videoURL: URL? = nil) {
self.imageURL = imageURL
self.text = text
self.videoURL = videoURL
@@ -26,7 +26,8 @@ open class LightboxImage {
imageView.image = image
completion?(image)
} else if let imageURL = imageURL {
LightboxConfig.loadImage(imageView, imageURL) { error, image in
LightboxConfig.loadImage(imageView, imageURL) { [weak self] _, image in
self?.image = image
completion?(image)
}
}
+1 -1
View File
@@ -108,7 +108,7 @@ extension FooterView: InfoLabelDelegate {
public func infoLabel(_ infoLabel: InfoLabel, didExpand expanded: Bool) {
resetFrames()
_ = expanded ? removeGradientLayer() : addGradientLayer(gradientColors)
_ = (expanded || infoLabel.fullText.isEmpty) ? removeGradientLayer() : addGradientLayer(gradientColors)
delegate?.footerView(self, didExpand: expanded)
}
}
+14 -2
View File
@@ -20,8 +20,14 @@ open class HeaderView: UIView {
let button = UIButton(type: .system)
button.frame.size = LightboxConfig.CloseButton.size
button.setAttributedTitle(title, for: UIControlState())
if let size = LightboxConfig.CloseButton.size {
button.frame.size = size
} else {
button.sizeToFit()
}
button.addTarget(self, action: #selector(closeButtonDidPress(_:)),
for: .touchUpInside)
@@ -41,8 +47,14 @@ open class HeaderView: UIView {
let button = UIButton(type: .system)
button.frame.size = LightboxConfig.DeleteButton.size
button.setAttributedTitle(title, for: .normal)
if let size = LightboxConfig.DeleteButton.size {
button.frame.size = size
} else {
button.sizeToFit()
}
button.addTarget(self, action: #selector(deleteButtonDidPress(_:)),
for: .touchUpInside)
+5 -1
View File
@@ -48,6 +48,10 @@ open class InfoLabel: UILabel {
return truncatedText
}
while numberOfLines(truncatedText) > numberOfVisibleLines * 2 {
truncatedText = String(truncatedText.characters.prefix(truncatedText.characters.count / 2))
}
truncatedText += ellipsis
let start = truncatedText.characters.index(truncatedText.endIndex, offsetBy: -(ellipsis.characters.count + 1))
@@ -119,7 +123,7 @@ open class InfoLabel: UILabel {
return string.boundingRect(
with: CGSize(width: bounds.size.width, height: CGFloat.greatestFiniteMagnitude),
options: [.usesLineFragmentOrigin, .usesFontLeading],
attributes: [NSFontAttributeName : font],
attributes: [NSFontAttributeName: font],
context: nil).height
}
+14 -7
View File
@@ -3,7 +3,7 @@ import UIKit
protocol PageViewDelegate: class {
func pageViewDidZoom(_ pageView: PageView)
func remoteImageDidLoad(_ image: UIImage?)
func remoteImageDidLoad(_ image: UIImage?, imageView: UIImageView)
func pageView(_ pageView: PageView, didTouchPlayButton videoURL: URL)
func pageViewDidTouch(_ pageView: PageView)
}
@@ -52,13 +52,17 @@ class PageView: UIScrollView {
configure()
activityIndicator.alpha = 1
self.image.addImageTo(imageView) { image in
self.isUserInteractionEnabled = true
self.configureImageView()
self.pageViewDelegate?.remoteImageDidLoad(image)
self.image.addImageTo(imageView) { [weak self] image in
guard let strongSelf = self else {
return
}
strongSelf.isUserInteractionEnabled = true
strongSelf.configureImageView()
strongSelf.pageViewDelegate?.remoteImageDidLoad(image, imageView: strongSelf.imageView)
UIView.animate(withDuration: 0.4) {
self.activityIndicator.alpha = 0
strongSelf.activityIndicator.alpha = 0
}
}
}
@@ -128,7 +132,10 @@ class PageView: UIScrollView {
}
func configureImageView() {
guard let image = imageView.image else { return }
guard let image = imageView.image else {
centerImageView()
return
}
let imageViewSize = imageView.frame.size
let imageSize = image.size