Commit 47ece6d1 by Daniel Dahan

updated

parent e2d53c9e
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'GK' s.name = 'MaterialKit'
s.version = '3.15.0' s.version = '1.0.0'
s.license = { :type => "AGPLv3+", :file => "LICENSE" } s.license = { :type => "AGPLv3+", :file => "LICENSE" }
s.summary = 'A powerful iOS / OSX framework for data-driven design.' s.summary = 'A Material Design Framework In Swift'
s.homepage = 'https://github.com/GraphKit/GraphKit' s.homepage = 'http://materialkit.io'
s.social_media_url = 'https://www.facebook.com/graphkit' s.social_media_url = 'https://www.facebook.com/graphkit'
s.authors = { 'GraphKit Inc.' => 'daniel@graphkit.io' } s.authors = { 'GraphKit Inc.' => 'support@graphkit.io' }
s.source = { :git => 'https://github.com/GraphKit/GraphKit.git', :tag => s.version } s.source = { :git => 'https://github.com/GraphKit/MaterialKit.git', :tag => s.version }
s.ios.deployment_target = '8.0' s.ios.deployment_target = '8.0'
s.osx.deployment_target = '10.10'
s.source_files = 'Source/*.swift' s.source_files = 'Source/*.swift'
s.requires_arc = true s.requires_arc = true
end end
......
...@@ -29,42 +29,42 @@ public protocol CaptureDelegate { ...@@ -29,42 +29,42 @@ public protocol CaptureDelegate {
} }
public class Capture: NSObject, AVCaptureFileOutputRecordingDelegate { public class Capture: NSObject, AVCaptureFileOutputRecordingDelegate {
/** //
* activeVideoInput // :name: activeVideoInput
* The video input that is currently active. // :description: The video input that is currently active.
*/ //
private var activeVideoInput: AVCaptureDeviceInput? private var activeVideoInput: AVCaptureDeviceInput?
/** //
* imageOutput // :name: imageOutput
* When the session is taking a photo, this is the output manager. // :description: When the session is taking a photo, this is the output manager.
*/ //
private lazy var imageOutput: AVCaptureStillImageOutput = AVCaptureStillImageOutput() private lazy var imageOutput: AVCaptureStillImageOutput = AVCaptureStillImageOutput()
/** //
* movieOutput // :name: movieOutput
* When the session is shooting a video, this is the output manager. // :description: When the session is shooting a video, this is the output manager.
*/ //
private lazy var movieOutput: AVCaptureMovieFileOutput = AVCaptureMovieFileOutput() private lazy var movieOutput: AVCaptureMovieFileOutput = AVCaptureMovieFileOutput()
/** //
* movieOutputURL // :name: movieOutputURL
* The output URL of the movie file. // :description: The output URL of the movie file.
*/ //
private var movieOutputURL: NSURL? private var movieOutputURL: NSURL?
/** //
* queue // :name: queue
* Async job queue. // :description: Async job queue.
*/ //
private lazy var queue: dispatch_queue_t = { private lazy var queue: dispatch_queue_t = {
return dispatch_queue_create("io.graphkit.Capture", nil) return dispatch_queue_create("io.graphkit.Capture", nil)
}() }()
/** //
* CaptureAdjustingExposureContext // :name: CaptureAdjustingExposureContext
* Used for KVO observation context. // :description: Used for KVO observation context.
*/ //
public var CaptureAdjustingExposureContext: NSString? public var CaptureAdjustingExposureContext: NSString?
/** /**
......
...@@ -74,8 +74,8 @@ public class Preview: UIView { ...@@ -74,8 +74,8 @@ public class Preview: UIView {
} }
/** /**
* session :name: session
* A mutator and accessor for the preview AVCaptureSession value. :description: A mutator and accessor for the preview AVCaptureSession value.
*/ */
public var session: AVCaptureSession { public var session: AVCaptureSession {
get { get {
...@@ -87,35 +87,35 @@ public class Preview: UIView { ...@@ -87,35 +87,35 @@ public class Preview: UIView {
} }
/** /**
* focusBox :name: focusBox
* An optional UIView for the focusBox animation. This is used when the :description: An optional UIView for the focusBox animation. This is used when the
* tapToFocusEnabled property is set to true. tapToFocusEnabled property is set to true.
*/ */
public var focusBox: UIView? public var focusBox: UIView?
/** /**
* exposureBox :name: exposureBox
* An optional UIView for the exposureBox animation. This is used when the :description: An optional UIView for the exposureBox animation. This is used when the
* tapToExposeEnabled property is set to true. tapToExposeEnabled property is set to true.
*/ */
public var exposureBox: UIView? public var exposureBox: UIView?
/** //
* singleTapRecognizer // :name: singleTapRecognizer
* Gesture recognizer for single tap. // :description: Gesture recognizer for single tap.
*/ //
private var singleTapRecognizer: UITapGestureRecognizer? private var singleTapRecognizer: UITapGestureRecognizer?
/** //
* doubleTapRecognizer // :name: doubleTapRecognizer
* Gesture recognizer for double tap. // :description: Gesture recognizer for double tap.
*/ //
private var doubleTapRecognizer: UITapGestureRecognizer? private var doubleTapRecognizer: UITapGestureRecognizer?
/** //
* doubleDoubleTapRecognizer // :name: doubleDoubleTapRecognizer
* Gesture recognizer for double/double tap. // :description: Gesture recognizer for double/double tap.
*/ //
private var doubleDoubleTapRecognizer: UITapGestureRecognizer? private var doubleDoubleTapRecognizer: UITapGestureRecognizer?
required public init(coder aDecoder: NSCoder) { required public init(coder aDecoder: NSCoder) {
...@@ -123,7 +123,7 @@ public class Preview: UIView { ...@@ -123,7 +123,7 @@ public class Preview: UIView {
setupView() setupView()
} }
override public init(frame: CGRect) { public override init(frame: CGRect) {
super.init(frame: frame) super.init(frame: frame)
setupView() setupView()
} }
...@@ -134,40 +134,35 @@ public class Preview: UIView { ...@@ -134,40 +134,35 @@ public class Preview: UIView {
setupView() setupView()
} }
/** //
* handleSingleTap // :name: handleSingleTap
* @param recognizer: UIGestureRecognizer //
* @delegate Calls preview(preview: Preview!, tappedToFocusAt point: CGPoint)
*/
internal func handleSingleTap(recognizer: UIGestureRecognizer) { internal func handleSingleTap(recognizer: UIGestureRecognizer) {
let point: CGPoint = recognizer.locationInView(self) let point: CGPoint = recognizer.locationInView(self)
runBoxAnimationOnView(focusBox, point: point) runBoxAnimationOnView(focusBox, point: point)
delegate?.previewTappedToFocusAt?(self, point: captureDevicePointForPoint(point)) delegate?.previewTappedToFocusAt?(self, point: captureDevicePointForPoint(point))
} }
/** //
* handleDoubleTap // :name: handleDoubleTap
* @param recognizer: UIGestureRecognizer //
* @delegate Calls preview(preview: Preview!, tappedToExposeAt point: CGPoint)
*/
internal func handleDoubleTap(recognizer: UIGestureRecognizer) { internal func handleDoubleTap(recognizer: UIGestureRecognizer) {
let point: CGPoint = recognizer.locationInView(self) let point: CGPoint = recognizer.locationInView(self)
runBoxAnimationOnView(exposureBox, point: point) runBoxAnimationOnView(exposureBox, point: point)
delegate?.previewTappedToExposeAt?(self, point: captureDevicePointForPoint(point)) delegate?.previewTappedToExposeAt?(self, point: captureDevicePointForPoint(point))
} }
/** //
* handleDoubleDoubleTap // :name: handleDoubleDoubleTap
* @param recognizer: UIGestureRecognizer //
*/
internal func handleDoubleDoubleTap(recognizer: UIGestureRecognizer) { internal func handleDoubleDoubleTap(recognizer: UIGestureRecognizer) {
runResetAnimation() runResetAnimation()
} }
/** //
* setupView // :name: setupView
* Common setup for view. // :description: Common setup for view.
*/ //
private func setupView() { private func setupView() {
let captureLayer: AVCaptureVideoPreviewLayer = layer as! AVCaptureVideoPreviewLayer let captureLayer: AVCaptureVideoPreviewLayer = layer as! AVCaptureVideoPreviewLayer
captureLayer.videoGravity = AVLayerVideoGravityResizeAspectFill captureLayer.videoGravity = AVLayerVideoGravityResizeAspectFill
...@@ -193,12 +188,10 @@ public class Preview: UIView { ...@@ -193,12 +188,10 @@ public class Preview: UIView {
addSubview(exposureBox!) addSubview(exposureBox!)
} }
/** //
* viewWithColor // :name: viewWithColor
* Initializes a UIView with a set UIColor. // :description: Initializes a UIView with a set UIColor.
* @param color: UIColor //
* @return Initialized UIView
*/
private func viewWithColor(color: UIColor) -> UIView { private func viewWithColor(color: UIColor) -> UIView {
let view: UIView = UIView(frame: Preview.boxBounds) let view: UIView = UIView(frame: Preview.boxBounds)
view.backgroundColor = .clearColor() view.backgroundColor = .clearColor()
...@@ -208,13 +201,11 @@ public class Preview: UIView { ...@@ -208,13 +201,11 @@ public class Preview: UIView {
return view return view
} }
/** //
* runBoxAnimationOnView // :name: runBoxAnimationOnView
* Runs the animation used for focusBox and exposureBox on single and double // :description: Runs the animation used for focusBox and exposureBox on single and double
* taps respectively at a given point. // taps respectively at a given point.
* @param view: UIView! //
* @param point: CGPoint
*/
private func runBoxAnimationOnView(view: UIView!, point: CGPoint) { private func runBoxAnimationOnView(view: UIView!, point: CGPoint) {
view.center = point view.center = point
view.hidden = false view.hidden = false
...@@ -230,22 +221,19 @@ public class Preview: UIView { ...@@ -230,22 +221,19 @@ public class Preview: UIView {
} }
} }
/** //
* captureDevicePointForPoint // :name: captureDevicePointForPoint
* Interprets the correct point from touch to preview layer. // :description: Interprets the correct point from touch to preview layer.
* @param point: CGPoint //
* @return A translated CGPoint value.
*/
private func captureDevicePointForPoint(point: CGPoint) -> CGPoint { private func captureDevicePointForPoint(point: CGPoint) -> CGPoint {
let previewLayer: AVCaptureVideoPreviewLayer = layer as! AVCaptureVideoPreviewLayer let previewLayer: AVCaptureVideoPreviewLayer = layer as! AVCaptureVideoPreviewLayer
return previewLayer.captureDevicePointOfInterestForPoint(point) return previewLayer.captureDevicePointOfInterestForPoint(point)
} }
/** //
* runResetAnimation // :name: runResetAnimation
* Executes the reset animation for focus and exposure. // :description: Executes the reset animation for focus and exposure.
* @delegate Calls preview(preview: Preview!, tappedToReset focus: UIView!, exposure: UIView!) //
*/
private func runResetAnimation() { private func runResetAnimation() {
if !tapToFocusEnabled && !tapToExposeEnabled { if !tapToFocusEnabled && !tapToExposeEnabled {
return return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment