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

Make ItemBaseController open #91

Merged
merged 2 commits into from
Nov 30, 2016
Merged
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
18 changes: 9 additions & 9 deletions ImageViewer/Source/ItemBaseController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ public protocol ItemView {
var image: UIImage? { get set }
}

public class ItemBaseController<T: UIView>: UIViewController, ItemController, UIGestureRecognizerDelegate, UIScrollViewDelegate where T: ItemView {
open class ItemBaseController<T: UIView>: UIViewController, ItemController, UIGestureRecognizerDelegate, UIScrollViewDelegate where T: ItemView {

//UI
var itemView = T()
public var itemView = T()
let scrollView = UIScrollView()
let activityIndicatorView = UIActivityIndicatorView(activityIndicatorStyle: .white)

Expand Down Expand Up @@ -60,7 +60,7 @@ public class ItemBaseController<T: UIView>: UIViewController, ItemController, UI

// MARK: - Initializers

init(index: Int, itemCount: Int, fetchImageBlock: @escaping FetchImageBlock, configuration: GalleryConfiguration, isInitialController: Bool = false) {
public init(index: Int, itemCount: Int, fetchImageBlock: @escaping FetchImageBlock, configuration: GalleryConfiguration, isInitialController: Bool = false) {

self.index = index
self.itemCount = itemCount
Expand Down Expand Up @@ -170,7 +170,7 @@ public class ItemBaseController<T: UIView>: UIViewController, ItemController, UI

// MARK: - View Controller Lifecycle

override public func viewDidLoad() {
override open func viewDidLoad() {
super.viewDidLoad()

createViewHierarchy()
Expand All @@ -196,25 +196,25 @@ public class ItemBaseController<T: UIView>: UIViewController, ItemController, UI
}
}

override public func viewWillAppear(_ animated: Bool) {
override open func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

self.delegate?.itemControllerWillAppear(self)
}

override public func viewDidAppear(_ animated: Bool) {
override open func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

self.delegate?.itemControllerDidAppear(self)
}

override public func viewWillDisappear(_ animated: Bool) {
override open func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)

self.delegate?.itemControllerWillDisappear(self)
}

override public func viewDidLayoutSubviews() {
override open func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()

scrollView.frame = self.view.bounds
Expand Down Expand Up @@ -579,7 +579,7 @@ public class ItemBaseController<T: UIView>: UIViewController, ItemController, UI
}

//Reports the continuous progress of Swipe To Dismiss to the Gallery View Controller
override public func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey: Any]?, context: UnsafeMutableRawPointer?) {
override open func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey: Any]?, context: UnsafeMutableRawPointer?) {

guard let swipingToDissmissInProgress = swipingToDismiss else { return }
guard keyPath == "contentOffset" else { return }
Expand Down