Commit dd1a97c2 by Daniel Dahan

latest updated for Xcode 8 beta 2

parent 15cbc145
......@@ -31,7 +31,7 @@
import UIKit
public class BottomNavigationFadeAnimatedTransitioning : NSObject, UIViewControllerAnimatedTransitioning {
public func animateTransition(_ transitionContext: UIViewControllerContextTransitioning) {
public func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
let fromView : UIView = transitionContext.view(forKey: UITransitionContextFromViewKey)!
let toView : UIView = transitionContext.view(forKey: UITransitionContextToViewKey)!
toView.alpha = 0
......@@ -39,7 +39,7 @@ public class BottomNavigationFadeAnimatedTransitioning : NSObject, UIViewControl
transitionContext.containerView().addSubview(fromView)
transitionContext.containerView().addSubview(toView)
UIView.animate(withDuration: transitionDuration(transitionContext),
UIView.animate(withDuration: transitionDuration(using: transitionContext),
animations: { _ in
toView.alpha = 1
fromView.alpha = 0
......@@ -48,7 +48,7 @@ public class BottomNavigationFadeAnimatedTransitioning : NSObject, UIViewControl
}
}
public func transitionDuration(_ transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
public func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
return 0.35
}
}
......
......@@ -347,7 +347,7 @@ public class Capture : View, UIGestureRecognizerDelegate {
internal func startTimer() {
timer?.invalidate()
timer = Timer(timeInterval: 0.5, target: self, selector: #selector(updateTimer), userInfo: nil, repeats: true)
RunLoop.main().add(timer!, forMode: .commonModes)
RunLoop.main.add(timer!, forMode: .commonModes)
(delegate as? CaptureDelegate)?.captureDidStartRecordTimer?(capture: self)
}
......
......@@ -721,10 +721,10 @@ public class CaptureSession: NSObject, AVCaptureFileOutputRecordingDelegate {
*/
private func uniqueURL() -> NSURL? {
do {
let directory: NSURL = try FileManager.default().urlForDirectory(.documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
let directory: NSURL = try FileManager.default.urlForDirectory(.documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .fullStyle
dateFormatter.timeStyle = .fullStyle
dateFormatter.dateStyle = .full
dateFormatter.timeStyle = .full
return directory.appendingPathComponent(dateFormatter.string(from: NSDate() as Date) + ".mov")
} catch let e as NSError {
delegate?.captureSessionCreateMovieFileFailedWithError?(captureSession: self, error: e)
......
......@@ -291,7 +291,6 @@ public class Layer: CAShapeLayer {
- Parameter animation: A CAAnimation instance.
*/
public func animate(animation: CAAnimation) {
animation.delegate = self
if let a = animation as? CABasicAnimation {
a.fromValue = (nil == presentation() ? self : presentation()!).value(forKeyPath: a.keyPath!)
}
......@@ -312,7 +311,7 @@ public class Layer: CAShapeLayer {
because it was completed or interrupted. True if completed, false
if interrupted.
*/
public override func animationDidStop(_ animation: CAAnimation, finished flag: Bool) {
public func animationDidStop(_ animation: CAAnimation, finished flag: Bool) {
if let a = animation as? CAPropertyAnimation {
if let b = a as? CABasicAnimation {
if let v = b.toValue {
......
......@@ -167,7 +167,7 @@ public extension UIImage {
has been retrieved.
*/
public class func contentsOfURL(url: URL, completion: ((image: UIImage?, error: NSError?) -> Void)) {
URLSession.shared().dataTask(with: URLRequest(url: url)) { (data: Data?, response: URLResponse?, error: NSError?) in
URLSession.shared.dataTask(with: URLRequest(url: url)) { (data: Data?, response: URLResponse?, error: NSError?) in
DispatchQueue.main.async {
if let v = error {
completion(image: nil, error: v)
......@@ -175,6 +175,6 @@ public extension UIImage {
completion(image: UIImage(data: v), error: nil)
}
}
}.resume()
}.resume()
}
}
......@@ -252,7 +252,7 @@ public extension UIView {
- Parameter animation: A CAAnimation instance.
*/
public func animate(animation: CAAnimation) {
animation.delegate = self
// animation.delegate = self
if let a = animation as? CABasicAnimation {
a.fromValue = (nil == layer.presentation() ? layer : layer.presentation()!).value(forKeyPath: a.keyPath!)
}
......@@ -273,7 +273,7 @@ public extension UIView {
because it was completed or interrupted. True if completed, false
if interrupted.
*/
public override func animationDidStop(_ animation: CAAnimation, finished flag: Bool) {
public func animationDidStop(_ animation: CAAnimation, finished flag: Bool) {
if let a = animation as? CAPropertyAnimation {
if let b = a as? CABasicAnimation {
if let v = b.toValue {
......
......@@ -86,7 +86,7 @@ public class MaterialCollectionViewLayout: UICollectionViewLayout {
public override func layoutAttributesForItem(at indexPath: IndexPath) -> UICollectionViewLayoutAttributes? {
let attributes = UICollectionViewLayoutAttributes(forCellWith: indexPath)
let item: MaterialDataSourceItem = dataSourceItems![indexPath.item!]
let item: MaterialDataSourceItem = dataSourceItems![indexPath.item]
if 0 < itemSize.width && 0 < itemSize.height {
attributes.frame = CGRect(x: offset.x, y: offset.y, width: itemSize.width - contentInset.left - contentInset.right, height: itemSize.height - contentInset.top - contentInset.bottom)
......
......@@ -333,7 +333,7 @@ public class TextView: UITextView {
/// Prepares the Notification handlers.
private func prepareNotificationHandlers() {
let defaultCenter = NotificationCenter.default()
let defaultCenter = NotificationCenter.default
defaultCenter.addObserver(self, selector: #selector(handleTextViewTextDidBegin), name: NSNotification.Name.UITextViewTextDidBeginEditing, object: self)
defaultCenter.addObserver(self, selector: #selector(handleTextViewTextDidChange), name: NSNotification.Name.UITextViewTextDidChange, object: self)
defaultCenter.addObserver(self, selector: #selector(handleTextViewTextDidEnd), name: NSNotification.Name.UITextViewTextDidEndEditing, object: self)
......@@ -341,7 +341,7 @@ public class TextView: UITextView {
/// Removes the Notification handlers.
private func removeNotificationHandlers() {
let defaultCenter = NotificationCenter.default()
let defaultCenter = NotificationCenter.default
defaultCenter.removeObserver(self, name: NSNotification.Name.UITextViewTextDidBeginEditing, object: self)
defaultCenter.removeObserver(self, name: NSNotification.Name.UITextViewTextDidChange, object: self)
defaultCenter.removeObserver(self, name: NSNotification.Name.UITextViewTextDidEndEditing, object: self)
......
......@@ -259,7 +259,8 @@ public class View: UIView {
/// Prepares the visualLayer property.
internal func prepareVisualLayer() {
visualLayer.zPosition = 0
visualLayer = CAShapeLayer()
visualLayer.zPosition = 0
visualLayer.masksToBounds = true
layer.addSublayer(visualLayer)
}
......
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