Skip to content

Commit

Permalink
Added access modifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
mozharovsky committed Jul 20, 2016
1 parent 2bf25b7 commit 5431005
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="G3e-Md-03a">
<rect key="frame" x="0.0" y="300" width="600" height="300"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="nfF-Ee-PLk">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="nfF-Ee-PLk">
<rect key="frame" x="235" y="85" width="130" height="130"/>
<state key="normal" image="TakePhotoIcon"/>
<connections>
Expand Down
2 changes: 1 addition & 1 deletion Source/Capturable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import AVFoundation
/// Provides featrues for previewing and capturing
/// using a device camera.
///
protocol Capturable: class {
public protocol Capturable: class {

/// Current capture session.
var session: AVCaptureSession? { get set }
Expand Down
12 changes: 6 additions & 6 deletions Source/CaptureNotificationObserver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import UIKit
///
/// A default observer around capture notifications.
///
final class CaptureNotificationObserver<T: Capturable>: NSObject {
unowned var capturable: T
public final class CaptureNotificationObserver<T: Capturable>: NSObject {
private unowned var capturable: T

init(capturable: T) {
public init(capturable: T) {
self.capturable = capturable
}

func register() {
public func register() {
let notificationCenter = NSNotificationCenter.defaultCenter()
notificationCenter.addObserver(
self,
Expand All @@ -27,11 +27,11 @@ final class CaptureNotificationObserver<T: Capturable>: NSObject {
)
}

func unregister() {
public func unregister() {
NSNotificationCenter.defaultCenter().removeObserver(self)
}

func willEnterForegroundNotification(notification: NSNotification) {
public func willEnterForegroundNotification(notification: NSNotification) {
capturable.willEnterForegroundNotification(notification)
}
}
10 changes: 5 additions & 5 deletions Source/CollectionViewChangeObserver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import Photos
/// A default implementation for `PHPhotoLibraryChangeObserver`
/// protocol observer object.
///
final class CollectionViewChangeObserver: NSObject {
let collectionView: UICollectionView
public final class CollectionViewChangeObserver: NSObject {
public let collectionView: UICollectionView

unowned var source: protocol<PhotoFetchable, PhotoCachable>
internal unowned var source: protocol<PhotoFetchable, PhotoCachable>

init(collectionView: UICollectionView, source: protocol<PhotoFetchable, PhotoCachable>) {
public init(collectionView: UICollectionView, source: protocol<PhotoFetchable, PhotoCachable>) {
self.collectionView = collectionView
self.source = source
}
Expand All @@ -27,7 +27,7 @@ final class CollectionViewChangeObserver: NSObject {
// MARK: - PHPhotoLibraryChangeObserver

extension CollectionViewChangeObserver: PHPhotoLibraryChangeObserver {
func photoLibraryDidChange(changeInstance: PHChange) {
public func photoLibraryDidChange(changeInstance: PHChange) {
dispatch_async(dispatch_get_main_queue()) {
guard let collectionChanges = changeInstance.changeDetailsForFetchResult(self.source.fetchResult) else {
return
Expand Down
2 changes: 1 addition & 1 deletion Source/Cropable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import UIKit
///
/// A protocol providing zooming features to crop the content.
///
protocol Cropable {
public protocol Cropable {
/// A type for content view.
associatedtype ChildView: UIView

Expand Down
26 changes: 11 additions & 15 deletions Source/CropableScrollViewDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,28 @@ import UIKit
///
/// A `UIScrollViewDelegate` for `Cropable` objects.
///
final class CropableScrollViewDelegate<T: Cropable where T: AnyObject>: NSObject, UIScrollViewDelegate {
unowned var cropable: T
public final class CropableScrollViewDelegate<T: Cropable where T: AnyObject>: NSObject, UIScrollViewDelegate {
private unowned var cropable: T

let linesView = LinesView()
public let linesView = LinesView()

var panning = false
private var panning = false

init(cropable: T) {
self.cropable = cropable
}

// MARK: UIScrollViewDelegate

func scrollViewWillBeginZooming(scrollView: UIScrollView, withView view: UIView?) {
public func scrollViewWillBeginZooming(scrollView: UIScrollView, withView view: UIView?) {
cropable.willZoom()
}

func scrollViewDidZoom(scrollView: UIScrollView) {
public func scrollViewDidZoom(scrollView: UIScrollView) {
cropable.didZoom()
}

func scrollViewDidScroll(scrollView: UIScrollView) {
public func scrollViewDidScroll(scrollView: UIScrollView) {
if cropable.alwaysShowGuidelines {
cropable.highlightArea(true)
}
Expand All @@ -44,12 +44,12 @@ final class CropableScrollViewDelegate<T: Cropable where T: AnyObject>: NSObject
cropable.highlightArea(true)
}

func scrollViewWillBeginDragging(scrollView: UIScrollView) {
public func scrollViewWillBeginDragging(scrollView: UIScrollView) {
panning = true
cropable.highlightArea(true)
}

func scrollViewDidEndDragging(scrollView: UIScrollView, willDecelerate decelerate: Bool) {
public func scrollViewDidEndDragging(scrollView: UIScrollView, willDecelerate decelerate: Bool) {
panning = false

if cropable.alwaysShowGuidelines {
Expand All @@ -59,16 +59,12 @@ final class CropableScrollViewDelegate<T: Cropable where T: AnyObject>: NSObject
}
}

func scrollViewWillEndDragging(scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {

}

func scrollViewDidEndZooming(scrollView: UIScrollView, withView view: UIView?, atScale scale: CGFloat) {
public func scrollViewDidEndZooming(scrollView: UIScrollView, withView view: UIView?, atScale scale: CGFloat) {
cropable.willEndZooming()
cropable.didEndZooming()
}

func viewForZoomingInScrollView(scrollView: UIScrollView) -> UIView? {
public func viewForZoomingInScrollView(scrollView: UIScrollView) -> UIView? {
return cropable.childView
}
}
8 changes: 4 additions & 4 deletions Source/FloatingViewLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import UIKit
/// - Folded: the visible area is shown.
/// - Moved: the floating view is moved.
///
enum State {
public enum State {
case Unfolded
case Folded
case Moved
Expand All @@ -36,7 +36,7 @@ enum State {
/// and current touch points as an associated value. Note, that this value
/// type supports only vertical states for now.
///
enum Direction {
public enum Direction {
case Up(delta: CGFloat)
case Down(delta: CGFloat)
case None
Expand Down Expand Up @@ -73,7 +73,7 @@ enum Direction {
///
/// Options for floating dragging zone.
///
enum DraggingZone {
public enum DraggingZone {
case All
case Some(CGFloat)
}
Expand All @@ -83,7 +83,7 @@ enum DraggingZone {
/// on pan gestures. The default implementation supports vertical
/// movement of a given view staying on the top of its superview.
///
protocol FloatingViewLayout: class {
public protocol FloatingViewLayout: class {
/// Determines the minimum area (height or width) to be visible
/// when the floating view is folded.
var visibleArea: CGFloat { get set }
Expand Down
12 changes: 6 additions & 6 deletions Source/LinesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import UIKit
/// Draws the horizontal and vertical lines to show
/// that a cropping is happening right now.
///
final class LinesView: UIView {
var lines = 3 { didSet { setNeedsDisplay() } }
var columns = 3 { didSet { setNeedsDisplay() } }
var width: CGFloat = 1 { didSet { setNeedsDisplay() } }
var color = UIColor.whiteColor() { didSet { setNeedsDisplay() } }
public final class LinesView: UIView {
public var lines = 3 { didSet { setNeedsDisplay() } }
public var columns = 3 { didSet { setNeedsDisplay() } }
public var width: CGFloat = 1 { didSet { setNeedsDisplay() } }
public var color = UIColor.whiteColor() { didSet { setNeedsDisplay() } }

override func drawRect(rect: CGRect) {
override public func drawRect(rect: CGRect) {
let verticalSpace = rect.height / CGFloat(lines)
let horizontalSpace = rect.width / CGFloat(columns)

Expand Down
2 changes: 1 addition & 1 deletion Source/PhotoCachable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Photos
///
/// Provides caching capabilities.
///
protocol PhotoCachable: class {
public protocol PhotoCachable: class {
/// A caching image manager doing all the job.
var cachingImageManager: PHCachingImageManager { get set }

Expand Down
2 changes: 1 addition & 1 deletion Source/PhotoCapturable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import AVFoundation
///
/// Provides still image capturing features.
///
protocol PhotoCapturable: Capturable {
public protocol PhotoCapturable: Capturable {
///
/// Captures a still image from the current input.
///
Expand Down
2 changes: 1 addition & 1 deletion Source/PhotoFetchable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Photos
///
/// Provides photos' fetching features.
///
protocol PhotoFetchable {
public protocol PhotoFetchable {
/// Current fetch result object.
var fetchResult: PHFetchResult { get set }

Expand Down

0 comments on commit 5431005

Please sign in to comment.